Add Prefix/Suffix to Each Line
Paste a list of lines and add the same prefix and/or suffix to every single one, useful for building code snippets, SQL lists, or formatted exports.
About Add Prefix/Suffix to Each Line
This tool takes whatever's pasted in, splits it into individual lines, and wraps each one with the prefix and suffix text set above. It updates live while typing, so the exact result is visible before copying it out. With "Skip blank lines" turned on, empty lines in the input stay empty in the output instead of turning into a prefix and suffix with nothing in between, which keeps spacing and formatting intact.
- Prefix and suffix, either one can be left empty if only one side needs adding.
- Skip blank lines, on by default, preserves blank lines as truly blank rather than prefix+suffix pairs.
- Live preview, the result updates as soon as any input changes.
Turning a plain list into a SQL or code snippet
This is a common enough job that it's worth naming directly: a plain list of values pasted from a spreadsheet needs to become a SQL IN clause, each value quoted and comma-separated, or a list of variable names needs to become a series of destructured object keys. Setting prefix to ' and suffix to ', turns a bare list of IDs into ready-to-paste SQL values in one pass, faster and less error-prone than manually adding quotes and commas to each line by hand, especially past a dozen or so entries where a manual approach starts risking a missed comma or an unmatched quote.
Building a Markdown or HTML list
A prefix of - turns a plain list into Markdown bullet points instantly, and a prefix of <li> paired with a suffix of </li> does the same for an HTML unordered list, both are quick conversions that would otherwise mean manually retyping the same wrapper text on every single line. Command-line flag lists work the same way, a prefix of -- turns a plain list of option names into a properly formatted flag list for a shell command or config file.
What "Skip blank lines" actually changes
Without it, a blank line in the middle of a pasted block gets the prefix and suffix applied to nothing, turning an empty line into literal prefix-suffix text sitting on its own line, which is rarely the intended result. With it on, a blank line passes through untouched, preserving whatever paragraph or section spacing existed in the original input. Leading and trailing spaces within a non-blank line are left exactly as pasted, only the line's overall blank-or-not status is checked, so existing indentation inside a line is never stripped or altered.
A faster alternative to spreadsheet formulas or find-and-replace
The same result can technically be produced with a spreadsheet concatenation formula or a careful find-and-replace with regex support, but both come with extra setup for a task that's genuinely simple, define the prefix and suffix once, and every line gets it applied instantly with a live preview to confirm the result looks right before committing to it. For a one-off list of a dozen entries or a recurring weekly export that needs the same wrapping applied every time, typing the prefix and suffix directly is faster than building or remembering a formula.
Handling text that already contains quotes or special characters
Because the prefix and suffix are inserted exactly as typed with no automatic escaping, wrapping a line that itself contains the same quote character used as a delimiter, a value like O'Brien going into a single-quoted SQL list, produces output that would break as SQL syntax without additional escaping handled separately. This tool focuses purely on wrapping every line consistently, it doesn't attempt to detect or escape characters that might conflict with the prefix or suffix being added, that step still needs to happen separately for data that isn't already clean.
Frequently Asked Questions
Can I use this to build a SQL IN clause from a list of values?
Yes. Setting the prefix to a single quote and the suffix to a comma and single quote turns a plain list of values into ready-to-paste SQL syntax in one pass, faster and less error-prone than manually quoting each line by hand.
What happens to blank lines with "Skip blank lines" turned off?
They get the prefix and suffix applied to nothing, turning an empty line into literal prefix-suffix text on its own line. Leaving "Skip blank lines" on keeps genuinely empty lines empty, preserving the original spacing instead.
Does this tool trim extra spaces from each line?
No. Only the entire line's blank-or-not status is checked for the skip option, any existing leading or trailing spaces within a non-blank line are preserved exactly as pasted, only the prefix and suffix are added around them.
Can I add only a prefix, or only a suffix?
Yes, either field can be left empty. Leaving the suffix blank adds only a prefix to each line, and vice versa.
Does this tool escape special characters like quotes automatically?
No. The prefix and suffix are inserted exactly as typed with no automatic escaping. A line containing a quote character that matches a SQL delimiter, for example, needs to be escaped separately before or after using this tool, it only handles the wrapping itself.
Is this faster than using a spreadsheet formula for the same result?
For most cases, yes. A spreadsheet concatenation formula works too but requires setup for each use, typing the prefix and suffix here applies instantly to every line with a live preview, faster for a one-off list or a recurring task that doesn't justify building a reusable formula.