Convert newlines to commas

Paste a list with one item per line and get a single comma-separated string back. The newlines to commas converter joins your lines with a separator (comma plus space by default) and offers toggles for trimming, quoting, run collapsing and double-separator suppression. The Separator field accepts any string, so you can join with a pipe, a semicolon or a custom delimiter. The transform runs in your browser; nothing uploads.

Input
Line 1:1 LF cloud_done Saved locally
Result Newlines to Commas
0 lines 0 chars

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

  1. 1Paste a line-per-item list into the input panel on the left.
  2. 2Set the Separator field if you want something other than , .
  3. 3Toggle Trim Lines, Quote Lines and Collapse Runs to taste.
  4. 4The joined string appears in the output panel on the right as you type.
  5. 5Click Copy in the output header to copy the result.

Keyboard shortcuts

Drive TextResult without touching the mouse.

Shortcut Action
Ctrl FOpen the find & replace panel inside the input Plus
Ctrl ZUndo the last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor Plus
EscClose find & replace, or exit fullscreen
Ctrl KOpen the command palette to jump to any tool Plus
Ctrl SSave current workflow draft Plus
Ctrl PRun 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.

Input
apple
banana
cherry
Output
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?
Turn on Quote Lines. Every line gets wrapped in double quotes before the join, so 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?
Yes. Type any string into the Separator field. Common alternatives are ; , | , 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?
When on, empty lines in the input are dropped before the join, so a double newline does not produce an empty piece. When off, every line (including empty ones) becomes a piece, so a\n\nb joins to a, , b with the default separator. On is the right choice for most prose lists.
Is the list sent anywhere?
No. The split and join run entirely in your browser via JavaScript. Nothing is uploaded, nothing is logged, no record of your data exists on our servers.
How do I go the other way?
Paste your comma-separated string into commas to newlines. That tool splits on every comma and writes one item per line, with toggles for trimming, repeat collapsing and digit-comma protection.