How to Add a Prefix to Every Line in Seconds
Every developer has been there: you have a list of items and need to prepend the same text to each line. Maybe it's wrapping items in quotes for a JSON array, building SQL INSERT statements, or adding comment markers to a log file.
You could do it manually. Or you could use the Add Prefix to Lines tool and finish in seconds.
What is prefixing text?
Prefixing means adding the same text to the beginning of each line. For example, adding INSERT INTO to a list of table names:
users → INSERT INTO users
products → INSERT INTO products
orders → INSERT INTO orders
Common use cases
SQL INSERT statements
Generate batch INSERT statements from a plain list of table names:
users
products
orders
customers
Becomes:
INSERT INTO users;
INSERT INTO products;
INSERT INTO orders;
INSERT INTO customers;
Just enter your list, set the prefix to INSERT INTO , and copy the result.
JSON arrays
Turn a list into a JSON-compatible array:
apple
banana
cherry
Becomes:
"apple",
"banana",
"cherry",
Comment headers in code
Add the same comment marker to multiple lines:
TODO: Fix login bug
TODO: Update dependencies
TODO: Add error boundary
TODO: Write tests
Set the prefix to # (or // for JavaScript) and the tool preserves blank lines.
Batch file operations
Building shell commands from a list of filenames:
config.yaml
data.json
secrets.env
Set prefix to echo "Loading: " to get:
echo "Loading: config.yaml"
echo "Loading: data.json"
echo "Loading: secrets.env"
Options explained
The tool has two options:
- Prefix — the text to prepend to each line. Can be a single character, a word, or a full phrase.
- Skip empty lines — when enabled (default), blank lines are left untouched. Disable this to prefix every line including empty ones.
Why do this in the browser?
Unlike spreadsheet workarounds or regex find-and-replace tricks, the browser-based tool:
- Requires no software — works on any device
- No data leaves your machine — everything runs client-side
- Is instant — no upload, no processing delay
- Works offline after the first load
Try it now
Open the Add Prefix to Lines tool and paste your list. Set your prefix, and copy the result.
It's one of 13 free string tools on DevStringTools. No login, no tracking, no catch.