Comma Separator
This comma separator turns a column of items into a comma separated list, ready for SQL, JSON or a form field, and turns lists back into columns.
Runs in your browser. Nothing you type is sent or saved.
Why Use This Comma Separator
Both Directions
Turn a column into a list, or paste a comma separated list and get one item per line. Switching direction keeps your result as the new input, so you can go back without retyping.
Ready for SQL and JSON
Wrap the list in brackets with single quotes for an SQL IN clause, or in square brackets with double quotes for a JSON array. Quotes inside items are escaped the right way for each.
Clean Before Joining
Spaces around each item are trimmed and blank lines are dropped. Turn on Remove duplicates to list each item once.
What a Comma Separated List Is
A comma separated list puts several values on one line with a comma between each one: red, green, blue. Forms, email fields, code and database queries usually want that shape, while spreadsheets and exports give you one value per row. Converting column to comma by hand means typing a comma after every line; here it takes one paste.
The delimiter does not have to be a comma. A semicolon is common where the comma is the decimal mark, a pipe or a tab suits data that already contains commas, and a new line turns a list back into a column. When an item contains the delimiter, quotes keep it whole. CSV doubles any double quote inside a quoted field, as RFC 4180 describes, and SQL doubles a single quote, so O'Brien becomes 'O''Brien'.
Format Options
- Delimiter:Comma, comma and space (the default), semicolon, pipe, tab, new line, or your own text of up to 5 characters.
- Quotes:None, double or single. A quote inside an item is doubled so the list stays valid.
- Wrap:None, round brackets for SQL, or square brackets for a JSON array. The JSON preset writes valid JSON strings, escaping inner double quotes with a backslash.
- Clean up:Trim items and Remove blank items are on by default. Remove duplicates is off until you need it, and keeps the first copy of each item.
- Warning:With quotes off, items that contain the delimiter are counted in a warning, because the list could not be split back the same way.
Common Use Cases
SQL IN Clauses
Paste a column of IDs or names and get ('a', 'b', 'c') ready for a WHERE ... IN query.
Excel and Google Sheets
Copy a column and get one line to paste into an email, a form or a search box.
Email Recipients
Join a column of addresses with semicolons or commas for the To field.
Tags and Keywords
Turn a list of tags into the comma separated text a CMS or a store listing expects.
Code Arrays
Wrap values in square brackets with double quotes to drop them into JavaScript or a JSON file.
How to Convert a Column to a Comma Separated List
Paste your column
Paste one item per line into the input box.
Choose the format
Pick a delimiter, quotes and a wrap, or leave the defaults.
Check the counts
The status line says how many items were joined and how many duplicates and blanks were removed.
Copy the list
Press Copy. To go the other way, switch Direction to List to column.
Benefits of This Comma Separator
Safe Round Trip
With quotes on, an item that contains a comma survives the trip from column to list and back unchanged.
Fewer Query Errors
Doubled single quotes mean a name like O'Brien does not break your SQL string.
Private
Everything runs in your browser. The data you paste is not uploaded.
Tips for Delimited Lists
- •Compare first: To find which items two lists share before you join them, use compare two lists.
- •Joining sentences: To join lines of text into one paragraph rather than a list, use paragraph to single line.
- •Whole tables: For rows and columns with headers, the CSV to JSON converter handles the full table.
Separate Your List Now
Paste a column above and your comma separated list is ready to copy.
Pick the SQL or JSON wrap if the list is going into code, and check the status line before you paste it.
Related tools
Frequently Asked Questions
How do I convert a column to a comma separated list?
Paste the column, one item per line. The list appears at once with a comma and a space between items; change the delimiter if you need another separator.
Can I turn a comma separated list back into a column?
Yes. Switch Direction to List to column and paste the list. Each item goes on its own line, and brackets around the list are removed.
How do I make a list for an SQL IN clause?
Choose single quotes and the round bracket wrap. A column of names becomes ('Ann', 'Bo', 'O''Brien'), with the quote in O'Brien doubled.
Can I use a semicolon, pipe or tab instead of a comma?
Yes. Choose it under Delimiter, or type your own separator of up to 5 characters.
What happens to quotes inside an item?
With double quotes, an inner double quote is doubled, as in CSV. With single quotes, an inner single quote is doubled, as in SQL. The JSON preset escapes inner double quotes with a backslash.
Can it remove duplicates?
Yes. Turn on Remove duplicates and only the first copy of each item is kept. The status line says how many were removed.