Line Breaks to Commas
Convert each line of text into a comma-separated list.
Input
Comma List
Converts each line to an item in a comma-separated list.
About the Line Breaks to Commas
Line Breaks to Commas turns a vertical list into a single comma-separated line. Paste one item per line, press the button, and the output joins them with a comma and a space, ready to drop into a spreadsheet cell, a SQL IN clause, a tag field or an email.
Each line is trimmed of leading and trailing whitespace first, and blank lines are dropped, so stray empty rows in the middle of a list do not produce double commas. The order of your items is preserved exactly.
The output is plain text, with no quotes around individual items. That is what most spreadsheets and tag fields expect. For a SQL query or a JSON array you will need to wrap each value in quotes, which is a different job.
Common questions about Line Breaks to Commas
What happens to blank lines?
They are removed, so the output has no empty entries and no doubled commas.
Are spaces around each item trimmed?
Yes. Leading and trailing whitespace is stripped from every line before joining.
Does it add quotes around items?
No, the result is plain comma-separated text. Quotes are left to you, since the correct style depends on where the list is going.
Can I convert the list back to lines?
Not with this tool, but replacing commas with line breaks in any text editor gives you the reverse.
Does it handle Windows line endings?
Yes. Both Unix and Windows line breaks are treated as line separators.
Is the order preserved?
Yes, items come out in the same order they went in.