Add Prefix to Lines — Bulk Line Editor, Free
Add a prefix or suffix to every line in text. Bulk line editing for code, lists, configs. Browser-only.
About Add Prefix to Lines
Adding a prefix or suffix to every line in a block of text is a common bulk-edit task — turn 100 names into "Hello, name" lines, comment out 50 lines of code, indent paragraphs, prefix log lines with timestamps. The ZTools Add Prefix to Lines tool adds prefix and/or suffix to every non-empty line, optionally to blank lines too, with configurable line endings and per-line numbering. Faster than opening a code editor for one-off transformations.
Use cases
- Comment out a block of code. Add "// " prefix to 50 lines. Faster than 50 keystrokes.
- Build SQL VALUES list from a column. Paste 1000 user IDs, prefix "(", suffix ")," — get "(1)," "(2)," ready for INSERT.
- Format a list as Markdown bullets. Prefix "- " to every line.
- Generate an HTML <li> list. Prefix "<li>", suffix "</li>".
How it works
- Paste text. Any number of lines.
- Type prefix and / or suffix. Either or both. Empty allowed for either side.
- Configure. Skip empty lines, add to all (including blanks), per-line numbering (1., 2., ...), line ending (LF / CRLF).
- Apply. New text with the modification. Original preserved.
Examples
Input: 3 lines "alice\nbob\ncarol", prefix "Hello, "
Output: "Hello, alice\nHello, bob\nHello, carol".
Input: Same with suffix "!"
Output: "Hello, alice!\nHello, bob!\nHello, carol!"
Input: Numbered prefix "1. ", "2. ", ...
Output: "1. alice\n2. bob\n3. carol".
Input: Comment-out: prefix "// "
Output: Every line prefixed with the comment marker.
Frequently asked questions
Does it handle CRLF (Windows) line endings?
Yes — auto-detected and preserved. Toggle output to force LF or CRLF.
How are blank lines handled?
By default skipped. Toggle "include blanks" to also prefix them — useful for code commenting where blank lines need "//" too.
Can I prefix every Nth line only?
Toggle "every Nth line" — applies prefix to lines 1, N+1, 2N+1, etc.
Privacy?
All in browser.
Pro tips
- For SQL VALUES lists, prefix "(" + suffix ")," — then strip the trailing comma manually.
- For Markdown, "- " (dash + space) is the universal bullet prefix.
- For commenting code, the "include blanks" toggle preserves layout — without it, blank lines stay uncommented and you lose visual structure.
- For long batches, paste as JSON or CSV first — the tool can also auto-prefix CSV-row index.
Reviewed by Ahsan Mahmood · Last updated 2026-05-06 · Part of ZTools.
For the full,
formatted version of this page, please enable JavaScript and reload
https://ztools.zaions.com/add-prefix-to-lines.