Comma Separator: Turn a List into Comma-Separated Text
the list apple, banana, cherry
How do you convert a column into a comma-separated list?
A comma-separated list is one line of text with a separator between each item. This page converts a column of lines into that line, and converts the line back into a column.
- Paste your column into the box above, one item per line.
- Choose the separator you want between the items. The comma is the default; the tab, the semicolon and the pipe are on the same control, and you can type a character of your own.
- Choose whether the items are quoted. RFC 4180 rule 6 says fields containing line breaks, double quotes or commas should be enclosed in double quotes, and rule 7 says a double quote inside a quoted field is escaped by preceding it with another double quote.
- Set the tidy-up you want: trim the ends of each item, drop blank lines, remove repeats.
- Copy the line out of the output box. The conversion runs both ways on this one page: lines into a delimited list, and a delimited list back into lines. There is no separate inverse URL.
The same three items under four separators
Each row runs one input — three items, one per line — through a different separator. The character between the items is the only thing that changes from row to row.
| Separator | Character | The line it produces |
|---|---|---|
| comma | , | apple, banana, cherry |
| tab | tab | apple banana cherry |
| semicolon | ; | apple; banana; cherry |
| pipe | | | apple| banana| cherry |
Worked Example: four lines into one
Four lines, one of them blank, become apple, banana, cherry on a single line. The blank line is dropped, the spaces around each item are trimmed, and a comma and a space join what is left.
apple, banana, cherry
The output has three items rather than four because the blank line carried nothing to join. Turn the drop-blanks control off and it comes back as an empty item between two commas, which is what a spreadsheet would read as an empty cell.
What Changes the Output Line?
The separator you choose
A comma is the default because it is what most tools expect, but any character can do the job. Choose the tab when the items already contain commas, and the pipe when they contain both. Whatever you pick, the receiving program has to be told.
Trimming, blank lines and repeats
Text pasted out of a spreadsheet or a document usually carries trailing spaces and an empty line or two. The three tidy-up controls run in a fixed order — trim, then drop blanks, then remove repeats — and the working above the box names each one.
What this page does not do
This page rewrites text you paste. It does not open, convert or re-save a file, and it changes nothing about how your spreadsheet exports one.
Frequently Asked Questions
Is comma separated the same as CSV?
A comma-separated list is one line of text. CSV is a file format that also fixes how a value containing a comma, a quote or a line break is written.
What is a delimiter?
A delimiter is the character that marks a boundary between values in a line of text; the comma is the usual one, with the tab, the semicolon and the pipe as the common alternatives.
What is a comma separator?
It is a tool that puts a comma between the items of a list, so a column of lines becomes one line of text. This page does that, and does the reverse on the same URL.
Why is my CSV file not comma-separated?
Spreadsheet programs follow the machine's list separator, and in locales where the comma is the decimal mark that separator is a semicolon, which is why a CSV file can open without a single comma in it.
How do you put each item in quotes?
Set the quoting control above the box. Single and double wrap every item. The RFC 4180 setting wraps only the items that need it, which is what a spreadsheet expects.
How do you turn a comma list back into one item per line?
Use the direction control above the box. The list is then split on the separator you have chosen, and the same trimming and duplicate options apply to the result.
The rest of the site is on the full tool index.