Add Prefix and Suffix to Lines
Paste a list, type what should go before and after each line, and get the result instantly. Presets wrap lines in quotes, add commas, bullets or HTML tags and turn a column of values into a SQL IN list.
Use {n} in the prefix or suffix for the line number. \t inserts a tab.
How to use the Add Prefix and Suffix to Lines
- Paste your lines into the left box, one item per line.
- Type a prefix and a suffix, or pick a preset such as double quotes, comma at end or SQL IN.
- Choose options: skip or remove empty lines, trim spaces, or join everything into one line with a separator.
- Use {n} in the prefix or suffix to insert the line number, starting from any number you like.
- Press Apply, then copy the result or download it as a text file.
Common prefix and suffix recipes
Most list-formatting jobs come down to a handful of prefix and suffix combinations. Each example below turns the input lines red, green and blue into the result shown.
| Goal | Prefix | Suffix | Other options | Result |
|---|---|---|---|---|
| JavaScript or Python array items | " | ", | none | "red", "green", "blue", (one per line) |
| SQL IN list | ' | ' | Join with , , wrap in IN ( … ) | IN ('red', 'green', 'blue') |
| Markdown bullet list | - | (empty) | none | - red / - green / - blue |
| Markdown task list | - [ ] | (empty) | none | - [ ] red … |
| HTML list | <li> | </li> | Wrap in <ul>\n … \n</ul> | <ul> <li>red</li> … </ul> |
| Numbered steps | {n}. | (empty) | Start at 1 | 1. red / 2. green / 3. blue |
| CSV row | " | " | Join with ,, quotes doubled | "red","green","blue" |
| Hashtags | # | (empty) | Join with a space | #red #green #blue |
Escaping quotes inside your text
If a line already contains the same quote character you wrap it in, the output breaks: 'O'Neil' is not valid SQL. The Quotes inside text option fixes this before the prefix and suffix are added:
- Double them is the SQL and CSV rule:
O'NeilbecomesO''Neilandsay "hi"becomessay ""hi"". - Backslash is the rule for JavaScript, JSON-like strings, PHP and many shells:
O'NeilbecomesO\'Neil, and existing backslashes are doubled first. - Leave as is keeps the text untouched, which is right for bullets, HTML tags and plain text.
How the line counter and empty lines work
The tool splits your text at every line break (Windows, Mac and Linux line endings are all recognised) and processes each line in order. A line that contains only spaces counts as empty. With Skip empty lines on, empty lines stay in place but get no prefix or suffix and are not numbered, so a list with blank separators keeps its layout. With Remove empty lines on, they disappear from the result. When Join lines into one is on, empty lines are dropped so you never get doubled separators such as a, , b. The {n} token counts only the lines that actually receive the prefix and suffix.
Frequently asked questions
How do I add text to the beginning of every line?
Type the text in the Prefix box. It is added to the start of each line as you type. Leave the Suffix box empty if you only need a prefix.
How do I add a comma to the end of each line?
Click the Comma at end preset, or type a comma in the Suffix box. To wrap each line in quotes as well, set the prefix to " and the suffix to ", (quote then comma).
How do I turn a column of values into a SQL IN list?
Click the SQL IN preset. Each value is wrapped in single quotes, quotes inside values are doubled so O'Neil becomes 'O''Neil', the lines are joined with a comma and the result is wrapped in IN ( … ).
What does Skip empty lines do?
Empty lines are left as they are instead of getting the prefix and suffix, and they do not count for the {n} line number. Tick Remove empty lines to delete them completely. When lines are joined, empty lines are always skipped.
Can I number the lines?
Yes. Put {n} anywhere in the prefix or suffix, for example {n}. or Step {n}: and set the number to start from. Only lines that receive the prefix are counted.
How do I insert a tab or a new line?
Type \t for a tab and \n for a line break in the prefix, suffix, separator or wrap boxes. For example a separator of \n\n puts a blank line between items.
Is my text uploaded anywhere?
No. All processing happens in your browser with JavaScript, so your text never leaves your device. Your options are remembered locally for next time.