Adding double quotes to each line means wrapping every line of a plain list in matching quotation marks so each item becomes a string literal a parser can read. A list typed one item per line turns into a list of quoted strings, and from there into a JSON array, a SQL IN clause, or a quoted CSV row in a single step. The naive version of the task is trivial; the realistic version is not, because any line that already contains a quote forces a choice. The three common targets handle that quote differently, and the published rule for each is pinned to a different standard. A JSON string backslash-escapes an embedded double quote per RFC 8259, a SQL string literal doubles an embedded single quote per the rule PostgreSQL, SQLite and ISO SQL document, and a CSV field doubles an embedded double quote per RFC 4180. Apply the wrong rule and the result is a syntax error in the consumer. A purpose-built quoting tool, Add Quotes to Each Line, encodes these three rules plus a backtick preset for JavaScript template literals, applies the one matching your target, joins lines with commas, adds the surrounding brackets or parentheses, and reports how many lines were processed in one browser-only pass.

Why a Plain Quote Wrap Is Not Enough
A line in a pasted list might look like it's a "test". A text editor's Find and Replace can wrap that line in double quotes in a keystroke, producing "it's a "test"". The wrapping is symmetric and the result is broken the moment anything tries to parse it: a JSON parser reads the first inner double quote as the end of the string and the rest as garbage, a SQL engine sees a string that never closes, and a CSV reader cannot tell where the field ends. The visible problem is the extra quotes, but the real problem is that escaping is what makes embedded quotes content rather than syntax, and escaping is not uniform across formats.
The three common targets disagree in two places: which character marks a string boundary, and what happens when that character appears inside the value. JSON and CSV both use double quotes for the boundary, but JSON says the inner double quote becomes \" while CSV says it becomes "". SQL uses single quotes for the boundary, and says an inner single quote becomes ''. There is no overlap and no safe wrap-and-forget rule. The same input, run through three different presets on Add Quotes to Each Line, produces three different, correct outputs.
How to Add Double Quotes to Each Line
- Paste your list into the input area, one item per line.
- Click the preset for the format you need: JSON array, SQL IN clause, CSV row, plain quotes, or backtick template literals.
- Fine-tune quote style, delimiter, and escaping options if the defaults do not fit, including the trailing delimiter toggle and the blank-line skip.
- Copy the paste-ready output. The line count at the bottom of the page tells you how many items were processed.
The defaults are chosen for the common case. A JSON array preset joins lines with commas and surrounds the result with square brackets, with no trailing comma after the last item. A SQL IN clause preset does the same but with parentheses. A CSV row preset wraps each field in double quotes and joins them with commas on a single line, following the RFC 4180 rule. Plain quotes wraps every line in the chosen quote character with no delimiter. The backtick preset escapes backticks and the ${ sequence so pasted content cannot inject an expression into a JavaScript template literal.
The Escaping Rules Each Preset Applies
The table below compares what each preset does with a line that already contains a quote, and what surrounds the joined result. The exact escaping rules are the product: pick the preset that matches where you intend to paste the output.
| Preset | Wrapping character | Rule for an embedded quote | Lines joined with | Result surrounded by |
|---|---|---|---|---|
| JSON array | " (double) | Backslash-escape: " becomes \"; a backslash doubles too | , (comma) | [ ] |
| SQL IN clause | ' (single) | Double it: ' becomes '' | , (comma) | ( ) |
| CSV row | " (double) | Double it: " becomes "" | , (comma) | none, single line |
| Backtick template literal | ` (backtick) | Backslash-escape backticks and the ${ opener | none by default | none |
| Plain quotes | " ' ` (user choice) | Optional toggle, defaults to off | user-chosen | none |
The same line under each preset looks different by design. she said "hi" becomes "she said \"hi\"" in JSON, 'she said "hi"' in SQL (no escape needed because the inner quotes are double), and "she said ""hi""" in CSV. The SQL rule is documented in the PostgreSQL lexical structure documentation as the standard behaviour shared by PostgreSQL, SQLite and the ISO SQL standard.
Edge Cases and the Controls That Handle Them
A handful of behaviours explain why the output looks the way it does, and the individual controls cover the cases the defaults miss.
No trailing comma by default. A trailing comma after the last element is legal in some contexts but illegal in JSON arrays and in SQL IN clauses written for most engines, so the tool omits it. A toggle adds the trailing delimiter when the target format wants one, such as a config file that requires it.
Running it on its own output wraps again. If the JSON preset is applied to a list that already contains JSON strings, the resulting lines contain escaped quotes inside double quotes inside double quotes, because the tool cannot tell whether existing quotes in the input are content or previous wrapping. The fix is to start from the original unquoted list. This is documented behaviour, not a bug.
Blank lines and whitespace. Blank-line skipping and per-line trimming are available as toggles. They are off by default so the output mirrors the input structure, but turning them on produces a clean array when the pasted list contains stray empties or padded spaces from a chat copy-paste.
Escaping toggle. The escaping step can be turned off for cases where the input is already escaped or where the surrounding code does not need escaping. Most users leave it on.
Input size. The page accepts up to one million characters in a single linear pass, so even very long lists return quickly. The line count at the bottom of the page is a sanity check against truncated pastes.
Browser-only. Nothing is uploaded. The text stays in the current tab, which matters when the list is exactly the kind of identifier, name, or email collection a developer would rather not paste into a random website.
Putting the Output to Work
The pattern recurs in everyday development work. A colleague sends fifty IDs in a chat message and they need to become a WHERE id IN (...) list, an array literal in a test fixture, or a quoted CSV row for an import. Each of those wants different escaping, and each is what one of the presets produces. Beyond those three, the same wrapped list works for environment allowlists, feature-flag seed arrays, i18n string tables, and test data seeded from a configuration file.
The page pairs naturally with the site's duplicate-line remover: clean the list first, then quote it here. That sequence is worth doing, because the quoting tool does not deduplicate, and a repeated string in the input becomes a repeated string in the output. If the wrapping itself needs to be flexible, meaning arbitrary text before and after every line with no escaping at all, the site's Add Prefix and Suffix to Lines tool is the right choice instead; this page is the right choice when the wrapping has rules, because the rules are the product.
The next step is to open Add Quotes to Each Line, paste the list, and pick the preset that matches where the result is going. The output is paste-ready and the format's escaping is already correct.