About the Add Prefix and Suffix to Lines
This tool adds the same text to the beginning and/or end of every line. Type a prefix, a suffix or both, paste your list, and each line is wrapped instantly: turn a column of names into quoted, comma-separated values, add bullet points, wrap items in HTML <li> tags, or prepare values for a SQL IN (...) clause.
It saves time for developers turning spreadsheet columns into code, marketers adding UTM parameters or hashtags, SEO teams building URL lists, and anyone formatting lists for a document. Blank lines can be skipped so they stay empty, and lines can be trimmed first so stray spaces do not end up inside your quotes.
A separate "separator" box adds a comma (or anything else) after every line except the last, so lists come out without a trailing comma. Type \t for a tab. Your text stays in your browser.
How to use the add prefix and suffix to lines
- 1Paste your list with one item per line.
- 2Type the text to add at the start of each line in Prefix.
- 3Type the text to add at the end of each line in Suffix.
- 4Add a separator such as a comma if every line but the last needs one.
- 5Choose whether to trim lines and skip blank lines.
- 6Copy the result.
Formula and method
The text is split at every line break and each line is rebuilt as prefix + line + suffix, then the lines are joined again with line breaks. With "trim" on, leading and trailing spaces are removed from each line first, so " apple " becomes "apple" before it is wrapped.
With "skip blank lines" on, empty lines are left exactly as they are instead of becoming a lonely prefix and suffix. The separator is added after the suffix on every changed line except the last one, which is what you want for comma-separated lists in SQL, JSON or code: 'a', 'b', 'c' with no trailing comma. In the prefix, suffix and separator, \t is converted to a tab character.
Worked examples
Quote values for code or SQL
Each fruit is wrapped in single quotes and every line except the last gets a comma: 8 + 9 + 8 characters plus 2 line breaks = 27 characters, with no trailing comma.
Double-quoted JSON array items
Each state code gets two spaces of indentation and double quotes, the blank line is left alone, and the comma separator goes after every item except "TX", ready to paste between [ and ].
Wrap items in HTML list tags
The spaces around " Home " are trimmed first, the blank line is skipped, and the three items become list elements ready to place inside a <ul>.
Frequently asked questions
How do I add text to the beginning of every line?+
Paste your lines, type the text in the Prefix box and leave Suffix empty. Every line, except blank lines if you choose to skip them, now starts with your text.
How do I add a comma to the end of each line?+
Type a comma in the Separator box to add it after every line except the last, which avoids the trailing comma that breaks JSON and SQL. Put it in the Suffix box instead if you want it on every line, including the last.
How do I wrap each line in quotes?+
Put the same quote mark in both Prefix and Suffix, for example " and ". For a quoted, comma-separated list, use ' as both prefix and suffix and a comma as the separator, giving 'a', 'b', 'c' with no trailing comma.
Can I add a tab or bullet point to each line?+
Yes. Type \t in the prefix for a tab, or paste a bullet such as • or - followed by a space. Any characters, including emoji and HTML tags, can be used.
Why are my blank lines not changed?+
"Skip blank lines" is on, which keeps empty lines empty so paragraph spacing survives. Turn it off if you want every line, including empty ones, to receive the prefix and suffix.