Use this tool to add prefix and suffix to each line of a list in one pass, instead of typing the same quote, comma or tag forty times. Paste product codes, email addresses or keywords, type what goes before and after, and copy the result. It is built for anyone preparing SQL IN lists, JSON arrays, HTML menus or spreadsheet imports.
-
Runs entirely in your browser — nothing is uploaded. Pick a preset to fill both boxes, or type your own; leave a box empty to add text on one side only.
How to Add Prefix and Suffix to Each Line
The tool splits your text at every line break, optionally trims stray spaces and drops empty lines, then glues the prefix to the front and the suffix to the back of each remaining line. Presets fill both boxes with common wrappers, and typing in either box switches the preset back to Custom. Think of it as a small bulk line editor that does one job quickly.
Formula: for each line L (after trimming, if on): output line = prefix + L + suffix. Blank lines are removed when Skip blank lines is ticked. When Drop the trailing comma is ticked, a comma or semicolon at the end of the suffix is removed from the final line only. Lines are rejoined with a single line break (\n).
- Lines to edit — your list, one item per line.
- Preset — single quotes plus comma, double quotes plus comma, SQL IN list, HTML list item, Markdown bullet or Custom.
- Prefix and Suffix — any text, including spaces, quotes, tags or a full URL.
- Skip blank lines, Trim spaces, Drop the trailing comma — clean-up switches applied before wrapping.
Example Scenarios
| Input lines | Prefix / suffix and options | Output |
|---|---|---|
| apple, banana, cherry | ' / ', | 'apple', 'banana', 'cherry', |
| apple, banana, cherry | SQL IN list (trailing comma dropped) | 'apple', 'banana', 'cherry' |
| Home, About, Contact | <li> / </li> | <li>Home</li> and so on, 3 lines |
| milk, eggs | - / none | - milk - eggs |
red , a blank line, blue | Double quotes + comma, trim and skip on | "red", "blue", (1 blank skipped) |
| img1, img2 | https://example.com/ / .jpg | https://example.com/img1.jpg https://example.com/img2.jpg |
Add Text to Beginning of Each Line and Wrap Lines in Quotes Cleanly
Most errors come from the data, not the wrapping. Before you add prefix and suffix to each line, check that every item really sits on its own line; a list copied from a PDF or web page often hides two items on one line or splits one item over two.
- If you only need to add text to end of each line, leave the prefix empty. The same works the other way round for a prefix only.
- When you wrap lines in quotes for SQL or code, check the items themselves for quotes. A name like O’Brien breaks a single-quoted string unless you double the apostrophe.
- Keep Trim on for lists pasted from spreadsheets, which often carry trailing spaces or tabs you cannot see.
- For JSON arrays, use double quotes; JSON does not accept single-quoted strings.
Windows files end lines with a carriage return plus line feed, while macOS and Linux use a line feed alone. The tool accepts both and outputs line feeds, which every modern editor reads. Wikipedia’s article on newline characters explains the differences if a target system is picky.
Add Prefix and Suffix to Each Line FAQ
Is this line wrapper free and private?
Yes. Paste the list, type the two strings and copy the result. There is no sign-up, no line limit worth worrying about and no upload, since the work happens in your browser. That makes it safe for customer emails, internal IDs or anything else you would rather not paste into a server-side tool.How do I add prefix and suffix to each line in Excel?
Put the items in column A and join text with the ampersand operator, for example =CHAR(39)&A1&CHAR(39)&CHAR(44), which wraps the value in apostrophes and adds a comma. Fill the formula down, then copy and paste as values. CONCAT or TEXTJOIN work too in newer versions of Excel.How do I do the same thing in Python?
Split the text into lines and build a new string with a comprehension, such as ‘\n’.join(p + line + s for line in text.splitlines()). Add an if line.strip() condition to skip blank lines. For files, read with open() and write the joined result back out, keeping the original encoding.Is there an easy way in R or SAS?
In R, paste0(prefix, x, suffix) works on a whole character vector at once. In SAS, the CATS function joins strings and removes leading and trailing blanks, for example cats(prefix, name, suffix) in a DATA step. For one-off lists, pasting here is faster.Can I wrap each line in HTML tags?
Yes. To add prefix and suffix to each line as markup, choose the HTML list item preset to get li tags, or type any opening tag as the prefix and its closing tag as the suffix, such as td and /td for a table row. Add the surrounding ul, ol or table tags yourself when you paste the result.What happens to blank lines and extra spaces?
Skip blank lines and Trim are ticked when the page loads, so blank lines are dropped and spaces at both ends of each line are trimmed, so the output stays tidy. Untick Skip blank lines to keep them, in which case each empty line gets the prefix and suffix too. Untick Trim if leading spaces matter, such as indented code.Related Tools
Once a list is formatted, the reading time calculator for word counts tells you how long the text will take to read. For test IDs, the random number generator for test data produces them, and the data storage converter for file sizes helps when an export gets large. Come back whenever you need to add prefix and suffix to each line again.