Adding quotes to each line online means pasting a plain list — one item per line — into a browser-based tool that wraps every entry in the right quote characters, joins them with commas, and applies the escaping rule the target format actually requires. The hard part is not the prefix and suffix; it is the escaping inside the string. JSON, SQL, CSV, and JavaScript template literals each handle an embedded quote differently, and a tool that just slaps " around every line will quietly produce broken syntax the moment a list contains an apostrophe, a double quote, or a name like O'Brien. A quoting tool that follows published rules — RFC 8259 for JSON, RFC 4180 for CSV, and the doubled-single-quote rule used by PostgreSQL and the SQL standard for SQL — turns a chat message full of IDs into a paste-ready array, IN clause, or CSV row without a syntax error and without hand-editing line by line.
Most readers who search "add quotes to each line online" have already tried one of three quick paths: a regex find-and-replace in their editor, a formula in a spreadsheet, or a generic prefix-and-suffix tool. All three can put quotes around the lines; none of them will save you when the input contains characters that the destination format treats specially. The value of a purpose-built quoting tool is the rules baked into each preset, not the wrapping itself.

Why Quoting a List Looks Easy Until You Hit an Apostrophe
A list of 50 product IDs feels like a 30-second chore. The moment any line contains a quote character, the chore becomes a debugging session. If your target is a JSON array, a line like 5" monitor cannot just be wrapped in "..."; it has to become "5\" monitor", or the JSON parser stops reading at the embedded quote. If your target is a SQL WHERE id IN (...) clause, the same line needs single quotes around it with the embedded double quote left untouched — '5" monitor' — because the SQL string-literal grammar documented by PostgreSQL doubles embedded single quotes rather than backslash-escaping them. If your target is a CSV row, the field has to be wrapped in double quotes and the embedded quote doubled, per RFC 4180.
That three-way difference is exactly what a hand-rolled prefix-and-suffix approach gets wrong. It cannot tell whether a single quote in the input should be doubled (SQL), left alone (JSON inside a string), or escaped with a backslash (JavaScript template literal). The output is technically quoted and semantically broken, and the bug is invisible until the parser rejects the file or the query returns zero rows because half the values got truncated at the first embedded quote.
How Each Format Handles Embedded Quotes
The escaping rules differ by format because the grammars differ by format. JSON is described by RFC 8259, which gives a backslash-escape for the double quote inside a double-quoted string. SQL string literals, as documented for PostgreSQL and adopted by the ISO standard and SQLite, double the single quote instead. CSV, defined by RFC 4180, wraps every field in double quotes and doubles an embedded double quote. The table below summarizes what each preset in Add Quotes to Each Line applies.
| Preset | Wrapper character | Embedded quote rule | Standard cited |
|---|---|---|---|
| JSON array | " (double quote) | " becomes \" ; \ becomes \\ | RFC 8259 |
| SQL IN clause | ' (single quote) | ' becomes '' (no backslash) | PostgreSQL / ISO SQL |
| CSV row | " (double quote) | " becomes "" (no backslash) | RFC 4180 |
| Backtick / JS template | ` (backtick) | ` becomes \` ; ${ becomes \${ | ECMAScript template literal |
The same input produces visibly different, syntactically correct output under each preset. A line like she said "hi" wrapped for JSON becomes "she said \"hi\""; wrapped for CSV becomes "she said ""hi"""; wrapped for SQL becomes 'she said "hi"' with the double quotes untouched, because single quotes are the wrapping character and the input has none. Running the input through the wrong preset does not merely look wrong; it fails to parse.
How to Add Quotes to Each Line Online in Three Steps
- Paste your list into the input area, one item per line. Plain text with line breaks is enough — no need to pre-clean tabs or trailing spaces unless you want to.
- Click the preset for the format you need: JSON array, SQL IN clause, CSV row, or plain quotes. The preset picks the wrapper character, the delimiter, and the escaping rule for that format.
- Fine-tune if needed — quote style, delimiter, escaping on or off, blank-line skipping, per-line trimming — then copy the paste-ready result.
The output reports how many lines were processed. Inputs up to one million characters process in a single linear pass, so even long lists return instantly. Everything runs in your browser: the input never leaves the tab, is not uploaded to a server, is not stored, and is not tied to an account. That matters when the list contains the kind of identifiers, customer names, or internal IDs that should not be sent to a random service.
Choosing the Right Preset
The four presets cover the cases where you actually need a quoting tool rather than a generic prefix-and-suffix tool.
- JSON array — use when the destination is a JavaScript or Python literal, a fixture file, a config map value, or any consumer that parses RFC 8259. The output wraps each line in double quotes and adds the surrounding [ ].
- SQL IN clause — use for WHERE col IN (...) against PostgreSQL, SQLite, or any engine that follows the ISO string-literal rule. The output wraps each line in single quotes, doubles embedded apostrophes, and adds the surrounding ( ).
- CSV row — use for spreadsheet imports, data-pipeline outputs, or any consumer that follows RFC 4180. The output wraps every field in double quotes and emits the whole row on one line, ready to drop into a CSV column.
- Backtick / plain quotes — use for JavaScript template literals or anywhere you need a different wrapper character. The backtick preset escapes embedded backticks and the ${ interpolation opener so pasted content cannot inject an expression.
When the destination is custom — for example, a configuration file that uses its own quoting style — start from the preset closest to your target and adjust the quote style and delimiter controls to match.
Useful Controls Beyond the Presets
Everything the presets encode is also exposed as individual controls, which is useful when the destination is unusual or the list needs cleanup before quoting.
- Quote style — pick a wrapper character, or choose none for a bare comma-separated list. The same input can become a,b,c, "a","b","c", 'a','b','c', or `a`,`b`,`c` from one click to the next.
- Trailing delimiter — off by default, because a JSON array or SQL IN list with a trailing comma is a syntax error in most parsers. Turn it on when the target expects the trailing comma.
- Escaping — on or off. Turn it off when the lines are guaranteed free of quote characters and you want the raw wrap, or when you are quoting a list that you intend to embed inside another already-quoted context.
- Blank-line skipping — drop empty lines before quoting so a stray blank in the paste does not become an empty string element in the array.
- Per-line trimming — strip leading and trailing whitespace from each line so accidental indentation from the source does not leak into the output.
One behaviour is documented rather than hidden: running the tool on its own output wraps the lines again. A quoting tool cannot tell whether quotes in the input are content or wrapping, so re-running double-wraps by design. If you need different settings, start over from the original list.
Pair It With a Quick Cleanup Step
A list that needs quoting often needs cleanup first — duplicates removed, blank lines dropped, accidental whitespace stripped. The duplicate-line remover and handles the same one-million-character inputs, so the typical workflow is clean, then quote. If your list came from a colleague in chat, expect stray duplicates and a blank line at the end; running the list through a dedupe pass before quoting keeps the output shorter and avoids passing the same ID twice to a SQL query.
For lists that need arbitrary text around each line rather than format-aware quoting — comments in front of every line, bullet characters, file-path prefixes — the site's separate Add Prefix and Suffix to Lines tool is the better fit. That tool does no escaping and treats every line as opaque text, which is what you want when the wrapping is decoration rather than syntax.
For the broader set of list-shaping tasks — randomizing, sorting, comparing against another list, removing duplicates — the same in-browser, no-upload principle applies. The quoting step is usually the last one in the chain, after the list is shaped the way you need it and before it is pasted into the destination that actually cares about correct escaping.