Skip to content

Add Quotes to Each Line

Turn a pasted list into a paste-ready JSON array, SQL IN clause or CSV row in one click, with the escaping each format actually requires.

Privacy: your files never leave your device. All processing happens locally in your browser.

How to use

  1. 1.Paste your list, one item per line.
  2. 2.Click the preset for the format you need: JSON array, SQL IN clause, CSV row, or plain quotes.
  3. 3.Fine-tune quote style, delimiter or escaping if needed, then copy the paste-ready result.

About Add Quotes to Each Line

Add Quotes to Each Line turns a plain list, one item per line, into code you can paste straight into an editor, a query console or a spreadsheet import. It is the small chore every developer knows: a colleague sends fifty IDs in a chat message, and you need them as a JSON array, a SQL IN clause or a quoted CSV row. One click on the matching preset wraps every line in the right quote, joins them with commas, adds the surrounding brackets or parentheses, and, crucially, escapes the content the way that format actually requires.

Escaping is what separates this page from a generic prefix and suffix tool, and it is where hand-rolled attempts break. The JSON preset follows RFC 8259: an embedded double quote becomes a backslash escape and a backslash doubles, so a line containing say "hi" becomes a valid string literal instead of a syntax error. The SQL preset follows the standard string-literal rule used by PostgreSQL, SQLite and the ISO standard: an embedded single quote doubles, it does not take a backslash, so it's becomes 'it''s'. The CSV preset follows RFC 4180: fields are wrapped in double quotes and an embedded double quote doubles, with the whole row emitted on a single line. These three rules are different from one another, the difference is exactly what the presets encode, and each one is pinned against the standard it cites. The backtick style covers JavaScript template literals, escaping backticks and the interpolation opener so pasted content cannot inject an expression.

Everything the presets do is also available as individual controls: quote style including none, delimiter with or without a trailing one on the last line, off by default so a JSON array does not end with a stray comma, escaping on or off, blank-line skipping and per-line trimming. The result reports how many lines were processed. One behaviour is documented rather than hidden: running the tool on its own output wraps it again, because a quoting tool cannot know whether existing quotes are content or wrapping; if you need to re-wrap, start from the original list.

Input is capped at one million characters and processes in a single linear pass, so even very long lists return instantly. Everything runs in your browser: your data, which is often exactly the kind of ID list or name list you would rather not paste into a random website, is never uploaded, stored or attached to an account.

Use it for JSON fixtures, SQL WHERE ... IN lists, CSV construction, environment allowlists, test data, i18n string tables, feature-flag lists, or any moment where a list needs to become syntax. It pairs naturally with the site's duplicate-line remover and list comparison tools: clean the list first, then quote it here. The site's separate prefix and suffix tool remains the right choice when you need arbitrary text around each line; this page is the right choice when the wrapping has rules, because the rules are the product.

Methodology & sources

Split lines, optionally trim and drop blanks, escape each line per the selected format's published rule, RFC 8259 for JSON, doubled single quotes for SQL, RFC 4180 for CSV, then wrap and join with the chosen delimiter, leaving the last line clean unless a trailing delimiter is requested.

Frequently asked questions

How is embedded-quote escaping handled?
Per format, the way each standard requires: JSON backslash-escapes a double quote (RFC 8259), SQL doubles a single quote per the ISO rule PostgreSQL and SQLite document, and CSV doubles a double quote (RFC 4180). The same input produces different, correct escaping under each preset.
Why does the last line have no comma?
So the output is paste-ready: a JSON array or SQL IN list with a trailing comma is a syntax error in most contexts. A toggle adds the trailing delimiter when your target format wants it.
What happens if I run it on its own output?
It wraps again. The tool cannot know whether quotes in the input are content or previous wrapping, so re-running double-wraps by design; start from the original list if you need different settings.

Text Tools guides

View all