Free Add Prefix & Suffix to Lines Tool
Add a prefix and/or suffix to every line of text in one click. This is perfect for turning a plain list into bullets, wrapping the same quotation marks around each line, prepending dashes, or building comma-separated values.
Related list operations live in the Remove Duplicate Lines and Sort Lines tools, and the Text Column Formatter is the right next step if the decorated list needs to be aligned into columns.
How to use the Prefix & Suffix
- 1 Paste your list into the input area, one item per line.
- 2 Type the text to add at the start of each line and, if you need it, the text for the end.
- 3 Set the line range if only part of the list should be modified.
- 4 Copy the result; the preview updates as you type.
Turning a list into code
The most valuable use is the escape from manual quoting. A list of thirty column names pasted into a script needs a quote and comma on every line; done by hand that is sixty keystrokes and at least one mistake. Prefix and suffix applied together produce the same result in a single paste, and it is exact.
The same trick works for SQL value lists, environment variable exports, markdown link definitions, and CSV rows assembled from a single column. Anywhere a list of plain values needs to become a list of decorated values, this is the tool.
Details worth getting right
- Confirm whether your language needs a trailing comma on the final element; producing one and then deleting it is faster than the reverse.
- Turn off blank-line decoration when the input came from a document with paragraph breaks.
- Use the line range to leave a header row untouched.
- Check the preview for double spaces — a suffix that already starts with a space added after a trailing space in the input produces two.
Common uses
Wrapping each line in quotes for a SQL IN clause, turning a list into a Markdown bulleted list, adding HTML tags around each item, or prefixing log lines with a tag. Batch edits like these are tedious by hand and trivial with this tool.
Frequently asked questions
When is adding a prefix to every line useful?
Mostly when turning a plain list into code or structured data. Adding a quote to the start of each line and a quote plus comma to the end converts a column of names into a JavaScript or Python array literal in one action. Adding a URL prefix to a list of slugs turns them into full links. Both are the kind of mechanical edit that is tedious by hand and trivial programmatically.
Can it number the lines as well as add text?
Yes, if the numbering mode is enabled, each line receives a sequential number that you can place inside the prefix and suffix. Combined with a text marker this gives you a quick inventory list, a changelog numbering scheme, or the row labels for a table.
Will it skip blank lines?
That is a setting. Leaving blank lines untouched is usually right, because a blank line inside a code block or a paragraph break will break if it suddenly acquires a quote character. Enabling the option to decorate blank lines too is for cases where every single line genuinely needs the same treatment.
Related Text Tools
You might also need
Tools from other categories that people pair with the Prefix & Suffix: