Paste a list and add the same text to the start or end of every line. Pick a quick format for quotes, SQL, JSON, or Markdown, or type your own.
This tool runs entirely in your browser. What you enter is never sent anywhere.Your input is never sent anywhere.
DetailsType \t for a tab, \n for a line break, and {n} for a running number. Spaces you type are added too.
Options
Add text to the start or end of every line at once
Adding the same characters to dozens of lines by hand is slow, and a regular expression is overkill for the job. Paste your list here, type what goes at the start and end of each line, and the whole list is changed at once.
Beyond a plain prefix and suffix, the tool leaves the comma off the last line, joins lines into one, escapes quotes inside your values, and adds a running number. One-click formats cover quoted lists, SQL IN lists, JSON arrays, Markdown lists, and HTML list items.
Jobs this saves from find-and-replace
Lists for a SQL query
Turn a column of IDs or names into ('a', 'b', 'c') for an IN clause, with quotes escaped and no stray comma.
Arrays and strings in code
Quote each line and add commas to paste a list into a JSON file, a script, or a config as an array.
Markdown, HTML, and notes
Put - or - [ ] in front of each line for a bullet or task list, or wrap each line in <li> tags.
URLs, paths, and IDs
Add a domain in front of a column of page paths, an extension after file names, or a tag after each value before an import.
How to add a prefix and suffix in 4 steps
- Paste your list into the Your lines box, with one item on each line.
- Click a quick format, or type the text for the start and end of each line yourself.
- Adjust the options if needed, such as removing blank lines, trimming spaces, or joining into one line.
- Click Copy result.
Note: The result updates as you type. Choosing a quick format replaces the start, end, and join settings, so pick it first and then edit.
How the text is added
- Every line is changed in this order: spaces trimmed, blank lines handled, duplicates removed, then the text added.
- Blank lines are left alone by default. In Join into one line mode they are always removed.
- Remove duplicate lines keeps the first copy of each line and compares lines exactly, including upper and lower case.
- Escape quotes inside lines changes the line itself before the start and end text goes on. JSON mode escapes " and \ and writes a tab as \t. SQL mode doubles each single quote.
- Line above and Line below add a separate line at the top and bottom. In Join mode, Before all and After all attach to the joined line instead.
- Quick formats replace the start, end, and join boxes. The JSON array format also sets blank lines to be removed.
Settings for common line formats
Click the quick format named in the table, or type the same text yourself.
| Goal | Quick format | Result |
|---|---|---|
| Quote each line | "Quotes" | "apple" / "pear" |
| Quoted list with commas | "Quotes", + comma | "apple", / "pear", / "plum" |
| SQL IN list | SQL IN list | ('apple', 'pear', 'plum') |
| JSON array of strings | JSON array | [ / "apple", / "pear" / ] |
| Markdown bullet list | - Bullets | - apple / - pear |
| Task list | - [ ] Checklist | - [ ] apple / - [ ] pear |
| HTML list items | <li> HTML | <li>apple</li> / <li>pear</li> |
| Comment out lines | // Comment or # Comment | // apple / # apple |
| Full URLs from paths | Type https://example.com/ in the start box | https://example.com/about |
Strings and numbers differ in SQL. String values go in single quotes, while numeric IDs are best left unquoted. After clicking SQL IN list, clear the quote characters from the start and end boxes if your values are numbers.
Quotes, commas, and escaping in code-ready lists
The small details that make a pasted list work the first time.
No comma after the last item
A comma after every line leaves a trailing comma on the final item. JSON does not allow a trailing comma, and a SQL list with one is a syntax error.
Put the comma in End, except last line instead of the plain end box, and the last item stays clean.
Quotes inside your values
A value such as O'Brien breaks a single-quoted SQL string unless the apostrophe is written twice. In JSON, a double quote or backslash inside a string needs a backslash in front of it.
Set Escape quotes inside lines to match your target and the tool does it for you.
Single quotes, double quotes, and numbers
In SQL, single quotes mark string values and double quotes usually mark column or table names. Numeric IDs should normally stay unquoted, because quoting a number turns it into a string and the database may convert types.
JSON strings must use double quotes.
Common mistakes with line-by-line edits
A trailing comma on the last item
You add a comma to the end of every line and paste the list into JSON or SQL. The final comma makes the whole thing invalid.
💡 See the solution▼
A quote inside a value breaks the query
A name such as O'Brien ends the quoted string early, and the rest of the statement fails or reads wrong.
💡 See the solution▼
Quoting numeric IDs
A list of numeric IDs wrapped in single quotes becomes a list of strings, which a database may have to convert.
💡 See the solution▼
Extra text on blank lines
A prefix and suffix added to an empty line leaves a line holding only your characters, such as an empty pair of quotes.
💡 See the solution▼
Prefix and suffix questions
Q.How do I add text to the beginning or end of every line?
A. Paste your list, one item per line. Type the text for the start in Add to start of each line and the text for the end in Add to end of each line. The result updates as you type. Click Copy result when it looks right.
Q.How do I wrap each line in quotes and add commas?
A. Click the "Quotes", + comma button. It puts a quote at the start and end of every line and a comma after every line except the last, so the list has no trailing comma. Use 'Single quotes' if you need single quotes instead.
Q.How do I turn a list into a SQL IN clause?
A. Click SQL IN list. Each value is wrapped in single quotes, the values are joined with a comma and space, and the whole thing is placed in parentheses, for example ('a', 'b', 'c'). A single quote inside a value is doubled so the query stays valid. For numeric IDs, remove the quotes from the start and end boxes so the numbers stay unquoted.
Q.How do I make a JSON array of strings from a list?
A. Click JSON array. Each line becomes a quoted string, a comma follows every line but the last, and [ and ] go above and below. Quotes and backslashes inside a line are escaped, which JSON requires. JSON does not allow a trailing comma, which is why the last line gets none.
Q.What does End, except last line do?
A. Text in that box is added to the end of every line but the last one. It is meant for commas and separators, so you do not end up with a comma after the final item.
Q.Can I add a tab or a line break?
A. Yes. Type \t where you want a tab and \n where you want a line break, and type \\ for a literal backslash. You can use these in the start, end, join, and above or below boxes.
Q.Can I add a running number to each line?
A. Yes. Put {n} in the start, end, or end-except-last box, for example {n}. in the start box for 1. 2. 3. A Starts at box appears so you can begin at another number. Blank lines that are left alone do not use up a number.
Q.What happens to blank lines?
A. By default they are left as they are and get no text. The Blank lines menu can remove them or add the start and end text to them too. When Join into one line is on, blank lines are always dropped.
Q.How does Join into one line work?
A. It puts all the lines on one line, separated by whatever you type in Join with, such as a comma and space. The Before all and After all boxes then add text at the very start and end, such as ( and ).
Q.Is my text sent to a server?
A. No. The tool adds your text with JavaScript in your browser, and there is no upload step. Closing or reloading the page clears the text.
Your feedback
makes this tool better.
Tell us which features you'd like, what should be fixed, or which new tool you'd like to see. An engineer reads every submission and uses it to guide development.