The reliable way to add quotes to each line in Notepad++ is to copy the list, paste it into the Add Quotes to Each Line tool, choose the format you actually need, and copy the result back as valid JSON, SQL, CSV or plain quoted text. The tool handles the three different escape rules that turn a quick Notepad++ job into a debugging session when the lines you are wrapping already contain quotes, apostrophes, or backslashes.
Notepad++ is a great editor for editing one file at a time, but its Find-and-Replace dialog does not know the difference between a quote that is content and a quote that is wrapping. The moment your list contains names like O'Brien, code identifiers that already include double quotes, or file paths with backslashes, the prefix-and-suffix approach silently produces invalid output. A line such as he said "hi" wrapped with double quotes must become he said \"hi\" to be valid JSON, but it must become he said ""hi"" to be valid CSV. The same input, two different correct answers, and the regex Find-and-Replace dialog does not know which rule to apply. That is why most guides that explain how to add quotes to each line in Notepad++ stop short of telling you what to do when the values themselves contain quote characters.

Why Notepad++ Find-and-Replace Stops Working Once Quotes Are Inside Your Lines
The standard Notepad++ recipe is to press Ctrl+H, enable Regular expression, set Find what to ^(.*)$, and set Replace with to "\1". For a clean list of plain identifiers or numbers this works exactly as expected: every line gets wrapped in double quotes. The recipe appears in most tutorials because it is genuinely fast for that one case.
The recipe breaks in three specific situations:
- The values contain double quotes. Wrapping he said "hi" with double quotes produces "he said "hi"", which is a syntax error in JSON, CSV, and most languages. Find-and-Replace will do this happily without warning you.
- The values contain single quotes. A SQL WHERE id IN (...) list wraps each value in single quotes, so O'Brien must become 'O''Brien' to be valid. Doubling the quote is the documented SQL rule, and Notepad++ will not apply it for you.
- The values contain backslashes. JSON treats a backslash as an escape character, so the Windows path C:\new wrapped naively becomes "C:\new", which JSON parsers read as C:<newline>. The correct output is "C:\\new".
These three failure modes share a single cause: Find-and-Replace is a literal-text transformation, not a format-aware one. It can put the same character at the start and end of every line, but it cannot change the content of the line the way the target format requires.
The Three Escape Rules That Decide Whether Output Is Valid
Each major text format defines its own escape rule for embedded quote characters, and the rules disagree. The Add Quotes to Each Line tool encodes the published standard for each one.
| Format preset | Wrap character | Embedded-quote rule | Cited standard |
|---|---|---|---|
| JSON array | "..." | Embedded " becomes \" and \ becomes \\ | RFC 8259 |
| SQL IN clause | '...' | Embedded ' becomes '' | ISO SQL, PostgreSQL, SQLite |
| CSV row | "..." | Embedded " becomes "" | RFC 4180 |
| Backtick / template literal | `...` | Embedded ` and ${ are escaped | JavaScript template literal rule |
| Plain quotes | "..." or '...' | No escaping | None |
The same input string wrapped under each preset produces different, correct output. Try the line Tom's "folder" under the JSON, SQL, and CSV presets and the tool will emit, respectively, "Tom's \"folder\"", 'Tom''s "folder"', and "Tom's ""folder""". None of those is a syntax error in its target format. A Notepad++ Find-and-Replace pass produces the same broken result for all three.
How to Add Quotes to Each Line in Notepad++ With Correct Escaping
- Select and copy the list in Notepad++. Press Ctrl+A to select all, then Ctrl+C to copy. If the list is one item per line with no blank lines, that is exactly what the tool expects.
- Open the Add Quotes to Each Line tool. It runs entirely in your browser, so nothing is uploaded.
- Paste the list into the input box. Each item must be on its own line. If your list has stray blank lines, leave the skip-blank-lines toggle on.
- Click the preset for the format you need. JSON array adds the surrounding brackets and commas; SQL IN clause adds parentheses and commas; CSV row keeps everything on one line with double-quote wrappers; plain quotes wraps without joining.
- Adjust quote style, delimiter, or escaping if needed. Every preset is also available as an individual control, so you can change the wrap character, force a trailing delimiter, or turn escaping off for the simple cases where you know it is safe.
- Copy the result and paste back into Notepad++. The output reports how many lines were processed, so you can sanity-check that nothing was dropped.
The whole round trip takes longer to read about than to perform. For most lists you are looking at a copy, a click, a click, a copy, and a paste. For lists that already contain quote characters it is the difference between valid output and an hour of debugging.
Output Examples for JSON, SQL, CSV, and Plain Quotes
Suppose your list is five lines: alice, bob, O'Brien, he said "hi", and C:\new.
Under the JSON preset with default settings the tool produces a single line: ["alice","bob","O'Brien","he said \"hi\"","C:\\new"]. That is paste-ready for a JavaScript constant, a Python json.dumps fixture, or a test data file. The double quote inside he said "hi" is backslash-escaped and the backslash inside C:\new is doubled, which is what RFC 8259 requires.
The same input under the SQL preset produces a single line: ('alice','bob','O''Brien','he said "hi"','C:\new'). That is paste-ready for a WHERE id IN (...) clause in PostgreSQL, SQLite, or any ISO-compliant engine. The apostrophe inside O'Brien is doubled, following the string-literal rule documented for PostgreSQL's lexical structure, and the backslash inside C:\new is left alone because SQL does not treat backslash as an escape character.
Under the CSV preset the result is one row on a single line: "alice","bob","O'Brien","he said ""hi""","C:\new". That is paste-ready for a spreadsheet import or a CSV file that conforms to RFC 4180. Embedded double quotes are doubled, which is why the value he said "hi" comes out as he said ""hi"".
Under plain quotes with the comma delimiter left off, each line is wrapped without joining: "alice" "bob" "O'Brien" "he said "hi"" "C:\new". That is what you would paste back into Notepad++ if you want a quoted list rather than an array or row. The plain-quote preset is the one closest to what a Notepad++ Find-and-Replace pass gives you, and it is the only one where the difference between the two methods really is only the speed.
Re-Running, Trailing Commas, and Other Foot-Guns
Three behaviours of the tool are worth knowing about before you build a workflow around it.
The last line has no comma by default. A JSON array or SQL IN list with a trailing comma is a syntax error in most parsers. The default is therefore no trailing delimiter, and a toggle adds one for the rare targets that want it. Notepad++ users who have been hand-stripping trailing commas from regex output will recognise the problem.
Running the tool on its own output wraps again. The tool cannot know whether the quotes in the input are content or previous wrapping, so it treats them as content. Re-running on already-quoted output double-wraps. If you need to change settings, start from the original list rather than from a previous result.
Input is capped at one million characters. That covers very long ID lists, name lists, and environment allowlists, and the tool processes them in a single linear pass so the result returns instantly. If your list exceeds the cap, the text file splitter can break it into manageable chunks first.
Everything runs in your browser. The list, which is often exactly the kind of ID, name, or path list you would rather not paste into a random website, is never uploaded, stored, or attached to an account. That is why the tool is a safe drop-in for production data and not just for placeholder text.
Choosing Between Notepad++ and a Format-Aware Tool
There are two cases where a Notepad++-only workflow is genuinely the right answer. The first is a one-line edit: you have a single value to wrap and a regex would be overkill. The second is a recurring transformation you want to bind to a hotkey, in which case the Notepad++ macro recorder or the PythonScript plugin is more appropriate than any browser tool.
For everything in between, the deciding question is whether your list contains quote characters. If it does not, either approach works and the regex recipe is faster. If it does, the Add Quotes to Each Line tool is the safer default because the escaping rules it applies are the ones the parser on the other end will check. The no-regex method in Notepad++ is a useful middle ground if you need to keep the work inside the editor, and the paste-back fix guide walks through the editor-side version of the same workflow.
| Situation | Notepad++ regex recipe | Add Quotes to Each Line |
|---|---|---|
| Plain IDs or numbers, no embedded quotes | Fast, one shortcut | Two clicks |
| Names or paths with embedded quotes | Produces invalid output | Produces valid output |
| Mixed JSON, SQL, and CSV targets in one session | Manual re-editing required | One click per format |
| Sensitive production data | Stays on disk | Runs locally in the browser, never uploaded |
The point of the comparison is not that the browser tool is universally better. The point is that Notepad++ regex is a text transformation, and a quote-wrapping job with rules is a different kind of problem. Once you accept that the rules are the product, picking the tool that encodes the rules is the boring, correct choice.