Comma Separator

Convert a line-by-line list into a comma-separated string, or split a CSV string back into individual lines. Options for quoting, whitespace trimming, and a custom separator give you full control over the output format.

Enter your data above to convert it

How It Works

Comma-separated values (CSV) are one of the most widely used data interchange formats. This tool handles the two most common manual tasks: joining a list into a single CSV string, and splitting a CSV string back into a list.

Lines to CSV:
Each line of your input becomes one value in the output, separated by a comma (or your chosen separator). The options let you control the exact format:

- Trim whitespace: removes leading and trailing spaces from each line before joining.
- Add quotes: wraps each value in double quotes — useful when values may contain commas themselves, or when pasting into a spreadsheet that needs quoted strings.
- Custom separator: use any character in place of a comma — a semicolon for European locale spreadsheets, a pipe for database imports, a tab for tab-separated values.

Example:
Input:
apples
bananas
cherries

Output (with quotes): "apples","bananas","cherries"

CSV to Lines:
The input is split on the separator character. Each resulting value is placed on its own line. Options:
- Trim whitespace: strips spaces around each value after splitting.
- Strip quotes: removes surrounding double or single quotes from each value.

Example:
Input: "apples","bananas","cherries"
Output (strip quotes):
apples
bananas
cherries

This is useful when you receive data in a single row (from a database query, an API response, or a spreadsheet copy) and need to process each item separately.

Frequently Asked Questions

What if my values contain commas?

Enable "Add quotes" when converting lines to CSV. Quoted fields containing commas are a standard CSV convention. When going the other direction (CSV to lines), the tool currently splits on every comma, so if your values contain commas you should switch to a pipe "|" or semicolon separator and set the same character on both sides.

Can I use a separator other than a comma?

Yes. Type any character into the "Separator" field. Common choices are semicolons (European spreadsheets), pipes (database imports), or tabs. The same separator field is used in both directions.

Does this handle TSV (tab-separated values)?

Yes. Type a literal tab character into the separator field, or type \t and the tool will interpret it as a tab.

Why are my values not trimmed correctly?

Make sure the "Trim whitespace" option is checked. Without it, spaces around values are preserved exactly as entered. This is intentional — some workflows require the spaces to be kept.

Can I convert the result to uppercase or sort it?

After converting, copy the result and paste it into the Case Converter or Text Sorter tools on this site to further transform the values.