Add Prefix and Suffix to Each Line
Add text before and after every line at once, for building quoted lists, SQL values and bullet points.
Everything you type here is processed on your own device. No input is sent to a server, logged, or stored.
What the Add Prefix and Suffix to Each Line tool does
The add prefix and suffix to each line tool on this page will add text before and after every line at once, for building quoted lists, SQL values and bullet points. Paste your text in, pick the options you need, and copy the result straight back out. It is most often used for building a SQL IN clause from a pasted list of IDs. For a second version of this add prefix and suffix to each line tool, see FreeToolsWorld.org.
How to use it
- Paste your lines, one item per line.
- Set the text to put before and after each line.
- Turn on the final-line option if a trailing separator would be a syntax error.
- Copy the result.
How it works
The defaults here produce a quoted, comma-separated list — the shape needed for a SQL IN clause, a JSON array or a Python list. The "remove the suffix from the final line" option exists because a trailing comma is a syntax error in SQL and in JSON, while being perfectly legal in modern JavaScript and Python.
Other common uses: prefixing every line with "- " for a Markdown list, with "> " for a quoted email, or with "//" to comment out a block.
Nothing is escaped. If your lines contain the same quote character you are wrapping them in, the result will be broken — escape the content first, or use a quote style that does not collide with it.
When to use it
- Building a SQL IN clause from a pasted list of IDs.
- Turning a list into a JSON or Python array.
- Prefixing lines with Markdown bullets or email quote markers.
- Commenting out a block of lines.
Common mistakes to avoid
- Leaving a trailing comma where the target syntax forbids it.
- Wrapping in a quote character that appears in the content, without escaping.
- Forgetting that blank lines are skipped by default, which changes the line count.
Frequently asked questions
How do I turn a list into a SQL IN clause?
Use the default prefix and suffix to quote and comma-separate each line, turn on the final-line option to drop the trailing comma, then wrap the whole thing in parentheses.
Does it escape quotes in my content?
No. If a line contains the quote character you are wrapping with, the output will be broken. Escape the content first.
How do I make a Markdown bullet list?
Set the prefix to "- " and leave the suffix empty.