Add Prefix / Suffix to Lines

Add text before and after every line: SQL IN lists, quotes, bullets, tags.

About this tool

Paste a list with one item per line, then type a prefix and suffix or pick a preset. Every line is wrapped in place. Turn on Join to put everything on one line with a separator and opening and closing brackets. Blank lines and stray spaces can be skipped, and quotes can be escaped for SQL or JSON.

Turning lists into code, markup and more

A column copied from a spreadsheet, a list of IDs from a report or a set of keywords usually needs wrapping before you can use it. The default preset turns apple, banana, cherry and O'Neill into the SQL list ('apple', 'banana', 'cherry', 'O''Neill'), ready for a WHERE … IN clause, with the apostrophe safely doubled. The JSON preset gives ["apple", "banana"] with any double quotes escaped. Other presets wrap lines in <li> tags for an HTML list, add "- " for Markdown bullets, # for hashtags, // to comment out code, a trailing comma for a quick CSV row, or a base URL to turn paths into full links. Custom prefixes and suffixes cover anything else, such as quoting filenames for a shell command or adding a domain to usernames to make email addresses. Untick Join to keep one item per line. Type \n or \t in the separator box for a line break or a tab. Trimming removes spaces copied from spreadsheet cells, and skipping blank lines avoids empty '' entries. Honest limits: quote escaping handles SQL string literals and JSON/JavaScript strings only. For queries against a live database, use parameterised queries in your code rather than pasted value lists. Add line numbers, find and replace and list compare are related.

Frequently asked questions

How do I add text to the beginning of every line?

Type it in the Prefix box. It's added to the start of each line, and the Suffix box does the same at the end.

How do I make an SQL IN list from a column?

Paste the values and pick the SQL IN list preset. You get ('a', 'b', 'c') with any apostrophes doubled.

Can I keep one item per line?

Yes. Untick 'Join onto one line' and each line keeps its own prefix and suffix.

Is my list uploaded?

No. It's processed in your browser and nothing is stored or sent.