Separator converter

Convert lists between new lines, commas, spaces, semicolons, tabs and custom separators – with trimming and quotes.

Your text is processed in your browser and never sent to our server.

Quick presets:

0 characters · 0 words · 0 lines

How to replace new lines with commas (and back)

This converter changes the separator of a list in one step: one item per line → comma separated, comma separated → one per line, spaces → lines, tabs, semicolons, pipes or anything custom.

  1. Paste your list into the input box.
  2. Pick a quick preset such as new lines → comma, or choose the input separator in From and the output separator in To. The ⇄ button swaps them.
  3. Adjust the clean-up options and quotes if needed.
  4. Copy the result or send it on to another tool.

What the options do

  • Space after comma joins items with ", " (or "; ") instead of "," – nicer for reading, while plain commas suit CSV and code.
  • Trim items removes spaces around each item, so "a , b" becomes "a" and "b".
  • Remove empty items skips blank lines and double commas such as "a,,b".
  • Wrap in quotes puts each item in single or double quotes, ready for SQL IN (…), JavaScript arrays or CSV. Quotes inside an item are doubled (O'Brien → 'O''Brien').
  • Custom lets you use any text as a separator, e.g. - or ::. The Spaces input splits on any whitespace, including tabs and line breaks.

Examples

New lines to comma separated list:

apple
banana     →   apple, banana, cherry
cherry

Comma separated to new lines:

red, green ,blue,,   →   red
                         green
                         blue

IDs for an SQL query (new lines → comma, single quotes):

SK01
SK02       →   'SK01', 'SK02', 'SK03'
SK03

Frequently asked questions

How do I replace new lines with commas in Excel or Google Sheets?

Use =TEXTJOIN(", ", TRUE, A1:A100) to join a column with commas (Excel 2019+ and Google Sheets). To split a comma separated cell into rows use =TRANSPOSE(SPLIT(A1, ",")) in Google Sheets or =TEXTSPLIT(A1, , ",") in Excel 365. Or simply paste the column here.

How do I put a comma separated list on separate lines?

Click the comma → new lines preset and paste your list. Spaces after the commas are trimmed automatically.

How do I replace new lines with spaces?

Choose new lines → spaces. This joins broken lines from a PDF or e-mail into one paragraph. To clean up double spaces afterwards use the spaces remover.

Is my data safe?

Yes. The conversion runs in your browser and the text never leaves your computer.

Can I add a comma at the end of each line but keep the lines?

Yes, use add prefix and suffix with the "comma at end" preset. To sort the items first, try sort lines.