Comma Separator
The Comma Separator turns a list or a spreadsheet column into one line of comma separated values, and splits a comma list back into one item per line. It can add quotes and brackets for SQL IN and arrays, remove duplicates, skip empty lines and sort the items.
Paste a list, one item per line, or a line of items with commas.
Works on this device, so lists of email addresses, IDs or customer names are not sent anywhere. Quotes inside an item are doubled ('O''Brien'), as SQL and CSV expect.
What is the Comma Separator?
The Comma Separator is a free text tool for the many times you have a column of values and need them on one line, or the other way round. Paste names, IDs or email addresses copied from Excel or Google Sheets, one per line, and it joins them with a comma and space, or a separator you choose. It can wrap each item in single quotes for a SQL IN list, in double quotes for JSON or CSV, and put brackets around the whole list. Turn the direction around to split a line of comma, semicolon, tab or pipe separated values into lines. It respects quoted items that contain commas, trims spaces and can remove duplicates and sort.
Who it is for: For data analysts and developers writing SQL, spreadsheet users, marketers cleaning email lists, and anyone moving lists between apps.
How to use the Comma Separator
- Paste your list in Your text, one item per line or copied from a spreadsheet column.
- Choose what to put between items, such as a comma and space.
- Add quotes or brackets if you need a SQL IN list or an array.
- Switch on Remove duplicates or choose an order if you need them.
- Copy the result.
Why use it
- Both directionsJoin a list into one line, or split a line into a list.
- Ready for SQL and codeSingle or double quotes and brackets in one step, with quotes inside items doubled.
- Cleans as it goesTrims spaces, skips empty lines and removes duplicates if you want.
- PrivateWorks on this device, so customer lists are not uploaded.
At a glance
- What you put in
- A list, one item per line, or a line of items separated by commas, semicolons, tabs, pipes or spaces
- What you get
- One line with your chosen separator, quotes and brackets, or one item per line, with a count of items, duplicates and empty items
- Limits
- Plain text; very large pastes over a few megabytes may be slow on older phones; quotes inside items are doubled, not escaped with a backslash
- Privacy
- Runs in your browser. Nothing you enter is uploaded or stored.
- Price
- Free for everyone. No subscriptions, no payments, no watermark.
- Works offline
- Yes, once the page has loaded
- Last checked
- by AK Shine
Worked example
apple, banana, an empty line, cherry and banana again, one per line. Separator: comma and space. Quotes: single. Wrap: brackets. Remove duplicates: on.
('apple', 'banana', 'cherry'). 3 items, 1 duplicate removed, 1 empty item skipped. 29 characters.Ready to paste after WHERE fruit IN in a SQL query. The second banana and the empty line are dropped; the first-seen order is kept.
When to use something else
- For very large data, such as a CSV with many columns, a spreadsheet or a database import is better; to change CSV into JSON use CSV to JSON.
- To remove duplicate lines without joining them, use Remove Duplicate Lines; to sort lines, use Sort Lines Alphabetically.
- Backslash escaping, as some programming languages use, is not added. Items with a single quote become doubled, as SQL expects.
Questions people ask
How do I turn a column of data into a comma separated list?
Copy the column from Excel or Google Sheets and paste it into Your text. Each cell becomes one item. The result shows them on one line with a comma and space between them, ready to copy. Choose a different separator if you need one.
How do I make a list for a SQL IN clause?
Set Quote each item to single quotes and Wrap the whole list to brackets. A list of 101, 102 and 103 becomes ('101', '102', '103'). For numbers you can leave quotes off. A name like O'Brien becomes 'O''Brien', as SQL needs.
How do I split a comma separated list into lines?
Choose "Turn one line into a list" under What to do and paste your line. Each item goes on its own line. Commas inside quoted items, like "Lagos, Nigeria", are kept as one item.
Can Excel do this itself?
Yes. In Excel 2019 or Microsoft 365, =TEXTJOIN(", ",TRUE,A1:A100) joins a range, and Google Sheets has the same function. This tool is quicker when the list is not in a sheet, or when you need quotes, brackets or duplicates removed.
How do I remove duplicates from a comma separated list?
Paste the list, switch on Remove duplicates, and switch on Ignore case if Apple and apple should count as the same. The first one of each is kept in its place, and the status line shows how many were removed.
Why is there a space after each comma?
Comma and space is easier to read and is what most people mean by a comma separated list. For CSV files, code or systems that do not trim spaces, choose Comma only.