Newlines to commas, plain and predictable
Newlines to commas conversion splits your text on every line break and joins the resulting array with a separator string. The default Separator is , (comma plus space), which produces clean prose-style output. The field accepts any string, so you can join with ;, | , \t or a custom delimiter. Both \n and \r\n line endings are accepted as input; the join always uses the configured separator without re-introducing newlines.
Four toggles change the join behaviour. Collapse Runs, on by default, drops empty lines from the input before joining, so a double newline between items does not produce an empty cell in the output. Trim Lines, off by default, strips whitespace around each line before the join. Quote Lines, off by default, wraps every line in double quotes (handy for building a JSON-like list). No Double, off by default, prevents the separator from doubling up if a line already ends with the trimmed separator.
The toggles compose. Collapse Runs runs first to drop empties; Trim Lines runs next to clean each line; Quote Lines runs after that to wrap each line; No Double runs last to drop any trailing separator before the join inserts a fresh one. For the inverse direction, see commas to newlines.
How to use convert newlines to commas
- 1Paste a line-per-item list into the input panel on the left.
- 2Set the Separator field if you want something other than
,. - 3Toggle Trim Lines, Quote Lines and Collapse Runs to taste.
- 4The joined string appears in the output panel on the right as you type.
- 5Click Copy in the output header to copy the result.
Keyboard shortcuts
Drive TextResult without touching the mouse.
| Shortcut | Action |
|---|---|
| Ctrl F | Open the find & replace panel inside the input Plus |
| Ctrl Z | Undo the last input change |
| Ctrl Shift Z | Redo |
| Ctrl Shift Enter | Toggle fullscreen focus on the editor Plus |
| Esc | Close find & replace, or exit fullscreen |
| Ctrl K | Open the command palette to jump to any tool Plus |
| Ctrl S | Save current workflow draft Plus |
| Ctrl P | Run a saved workflow Plus |
What this tool actually does
Separator field, any string
The default is , (comma plus space). The field accepts any string, including a tab character (paste a literal tab), a pipe, a semicolon, or a custom delimiter. The same string is used between every adjacent pair of lines in the output. Setting it to the empty string concatenates the lines with no delimiter.
Collapse Runs toggle (default on)
When on, empty lines in the input are dropped before joining, so a double newline between items does not produce an empty piece in the output. When off, every line (including empty ones) becomes a piece, so a\n\nb joins to a, , b with the default separator.
Trim Lines toggle (default off)
When on, each line has its leading and trailing whitespace stripped via String.trim before the join. When off, the original spacing is kept exactly. Use this when the source had inconsistent indentation and you want a clean comma list.
Quote Lines toggle (default off)
When on, every line is wrapped in double quotes before the join, so the result reads like a JSON-style array body. apple\nbanana becomes "apple", "banana". The wrapping does not escape any inner quotes, so embedded quotes survive verbatim.
No Double toggle (default off)
When on, a line that already ends with the trimmed separator (so a line ending in , when the separator is , ) has the trailing match dropped before the join inserts a fresh separator. That prevents the output reading foo,, bar when the source already had stray trailing commas.
Worked example
Default settings. Three lines join with the default , separator into one string.
apple banana cherry
apple, banana, cherry
Settings reference
| Setting or rule | Effect on output |
|---|---|
Separator (default , ) |
String inserted between each adjacent pair of lines. |
| Collapse Runs (default on) | Drops empty lines before joining. Turn off to preserve every line as a piece. |
| Trim Lines (default off) | Strips leading and trailing whitespace from each line before the join. |
| Quote Lines (default off) | Wraps every line in double quotes before the join. |
| No Double (default off) | Drops a trailing trimmed separator from each line before the join. |
| Line endings accepted | LF and CRLF both treated as a line break. |
| Empty input | Emits an empty string. |
FAQ
How do I get a JSON-style list?
apple\nbanana becomes "apple", "banana". Wrap that in square brackets manually if you need a complete JSON array literal.Can I use a different separator?
; , | , a single tab, or a single comma without the trailing space. Setting it to the empty string concatenates the lines with no delimiter.What does Collapse Runs change?
a\n\nb joins to a, , b with the default separator. On is the right choice for most prose lists.