Comma Separator
Turn a column of words into one line, or one line back into a column. Paste keywords, URLs, IDs or names from a spreadsheet, choose how to separate them, and copy the result as you type. Ready-made formats for SQL, JSON, HTML lists and regular expressions save you the typing. Nothing leaves your browser.
About Comma Separator
Comma separator: turn a column into a comma-separated list, and back
A comma separator takes a list with one item per line, such as a column of keywords copied from a spreadsheet, and joins it into one line with commas between the items: red, green, blue. This free online comma separator also works the other way, splitting a comma-separated line back into a column. You can add quotes, change the separator to a semicolon, pipe, tab or anything else, remove duplicates, sort the list and build ready-made formats for SQL, JSON, CSV, HTML lists and regular expressions. Everything happens in your browser as you type.
Lists rarely arrive in the shape you need. A spreadsheet or a keyword tool gives you one keyword per row, but a tag field, an ad platform, a SQL query, a JSON file or a regex filter in Google Search Console wants them on one line, separated by commas or pipes, sometimes in quotes. Doing that by hand means pressing Delete and typing a comma hundreds of times, and one missed quote breaks the whole query. This guide explains how to use the tool, what each option does, which format fits which job, and the mistakes that most often break a delimited list.
How to convert a column to a comma-separated list
- Paste your list into "Column data". Copy a column from Excel, Google Sheets or any text file and paste it into the left box. One item per line is the usual input, but the tool also reads lists separated by commas, semicolons, tabs or spaces.
- Read the result in "Delimited data". The right box updates as you type. By default the items are joined with a comma and a space. Under each box you see how many items were read and how many ended up in the result.
- Choose a separator. Use the menu between the two boxes, or the "Separator" buttons in "3. Join the items": comma with a space, comma, semicolon, pipe, tab, space, new line, or "Other" for anything you type yourself.
- Pick a quick format if you need one. The buttons at the top ("a, b, c", "CSV row", "SQL IN ( )", "JSON array", "HTML list", "Regex (a|b)" and "One per line") set the quotes, separator, start and end in one click.
- Copy or download. Click "Copy result" to put the list on your clipboard, or "Download .txt" to save it as a text file named
list.txt.
To go the other way, paste a comma-separated line into "Delimited data", make sure the menu between the boxes shows the separator your line uses, and click the left arrow button ("Delimited to column"). The items appear in "Column data", one per line. The right arrow ("Column to delimited") rebuilds the result from the left box, and the red cross clears both boxes.
What a delimited list is
A delimiter is the character that marks where one item ends and the next begins. A comma-separated list uses commas, a pipe-delimited list uses |, and a tab-separated list uses the invisible tab character. A plain column is also a delimited list: its delimiter is the line break. Converting between them is only a matter of replacing one delimiter with another, as long as no item contains the delimiter itself. That last condition is where most trouble starts, and it is why quotes exist.
The options, step by step
The tool works in three stages, shown as three panels under the boxes. Each stage passes its result to the next, so it helps to know what happens where.
1. Read the list
"Items are separated by" tells the tool how to cut your input into items. "Detect automatically" works for most lists: if the text has more than one line, every line is an item; a single line is split at tabs, then semicolons (when there are no commas), then commas, then pipes. You can also force "New lines", "Commas", "Semicolons", "Tabs", "Spaces" or "Other character". When you split by commas or semicolons, a value in quotes such as "Paris, France" stays one item, and line breaks still separate items too.
- Remove spaces around items (on by default) trims spaces at the start and end of each item, so
red , greengivesredandgreen. - Skip empty items (on by default) drops blank lines and empty values between two separators.
- Remove duplicates keeps the first copy of each item and removes the rest. With "Ignore upper and lower case when comparing" ticked,
Running Shoesandrunning shoescount as the same item. The number of removed items is shown as "Duplicates removed". - Remove existing quotes strips a pair of quotes around an item, including curly quotes pasted from a word processor and backticks. Use it before adding your own quotes, so you do not end up with doubled quotes.
2. Shape each item
"Quotes" wraps every item in double quotes, single quotes or nothing. When an item already contains the same quote character, the tool doubles it, which is the rule in CSV files and in SQL: women's shoes becomes 'women''s shoes'. Tick "Escape quotes with a backslash (JSON, JavaScript)" for the other style, where the quote is written as \" and every backslash is doubled.
"Before each item" and "After each item" add any text around every item, for example <li> and </li>, a hashtag sign, or a URL prefix. "Letters" changes everything to lower case or upper case. "Order" keeps the original order, sorts A to Z or Z to A, or reverses the list. Sorting follows the language of the page and puts numbers in natural order, so item 2 comes before item 10, and it ignores differences in case and accents. "Escape regex characters" puts a backslash in front of characters that have a special meaning in regular expressions, such as the dot, the question mark, brackets and the pipe.
3. Join the items
"Separator" sets the text between items. Under "Other" you can type any separator, even several characters such as / or OR . Type \n for a line break and \t for a tab; that also works in the start, end, before and after fields. "Start of result" and "End of result" wrap the whole list, for example in brackets. "New line after every … items" breaks a long result into lines of a fixed size; when it is above 0, two more fields appear, "Start of each line" and "End of each line", which are handy for multi-row SQL inserts.
,\n puts each value on its own line.Which format to use for which job
Plain comma list
"a, b, c" gives a comma and a space with no quotes. Use it for tag fields in a CMS, keyword lists in a brief, location lists for ad targeting, or any text a person will read. If an item may contain a comma, choose a different separator or add quotes.
CSV row
"CSV row" puts each item in double quotes and joins them with a comma and no space. That follows the common CSV rules described in RFC 4180: a field that contains a comma, a quote or a line break is wrapped in double quotes, and a quote inside the field is written twice. Note that Excel in many European locales, including Germany, France, Spain, the Netherlands and Romania, expects a semicolon between fields, because the comma is the decimal separator there. If your file opens in one column, switch the separator to ;.
SQL IN ( )
"SQL IN ( )" wraps the items in single quotes, separates them with a comma and a space and puts brackets around the whole list, ready for WHERE keyword IN ('a', 'b', 'c'). Apostrophes inside values are doubled, which is the standard way to write a quote inside an SQL string. For a list of numbers, such as product IDs, set "Quotes" to "None" afterwards. Treat this as a convenience for your own queries; in application code, always pass user input as parameters rather than pasting it into SQL.
JSON array
"JSON array" gives ["a", "b", "c"]: double quotes, commas and square brackets, with quotes and backslashes inside items escaped with a backslash, as JSON requires. Paste it into a config file, a JavaScript variable or an API request.
HTML list
"HTML list" wraps each item in <li> tags, one per line, inside <ul> and </ul>. Change the start and end to <ol> for a numbered list. The tool does not escape characters such as & or < inside items, so check items that contain them before you publish.
Regex (a|b)
"Regex (a|b)" joins the items with a pipe inside brackets and escapes special characters, giving a group such as (shoes|socks|insoles). This is how you match several keywords or URLs at once in tools that accept regular expressions, such as the "Custom (regex)" query and page filters in the Google Search Console performance report or filters in Google Analytics. Escaping matters there: an unescaped dot matches any character, so example.com would also match example-com.
One per line
"One per line" sets the separator to a line break and removes quotes and brackets. Combined with "Detect automatically", it turns a comma-separated line pasted into the left box into a clean column, with duplicates removed or sorted if you want.
Real uses in SEO and everyday work
- Keyword lists. Export keywords from a research tool, remove duplicates and join them for a content brief, or turn them into a regex to filter Search Console queries for one topic. Our Keyword Clustering Tool can group a long list first.
- URL lists. Turn a column of URLs into a regex for page filters, into a quoted list for a script, or back into a column to paste into a crawler. Our Bulk Meta Tag Extractor takes one URL per line.
- Database work. Build an
IN (…)list from IDs or email addresses in a spreadsheet without writing a formula. - Developers. Make a JSON array or a JavaScript array of strings from a column of values, with escaping done for you.
- Content. Turn a list of features into an HTML list, or a column of tags into the comma-separated format a CMS or video platform asks for.
- Cleaning lists. Paste a messy list, tick "Remove duplicates", choose "A to Z" and "One per line", and copy back a sorted, unique column.
Common mistakes with delimited lists
- Items that contain the separator. A company name like
Smith, Jones & Cobreaks a plain comma list into two items. Use quotes, or a separator that never appears in your data, such as a pipe or a tab. - Curly quotes. Word processors turn straight quotes into typographic ones, which SQL and JSON do not accept as quotes. Tick "Remove existing quotes" and let the tool add straight quotes.
- Hidden spaces. A trailing space after a keyword makes
shoesandshoestwo different values in a database. Keep "Remove spaces around items" on. - Duplicates that differ only in case. Spreadsheets often contain the same keyword in different capitalisation. Remove duplicates with "Ignore upper and lower case when comparing" ticked, or first change everything to lower case.
- Unescaped regex characters. Dots, question marks and brackets in URLs change the meaning of a regular expression. Keep "Escape regex characters" on when you build a regex from URLs.
- The wrong separator for your locale. A CSV row with commas may open in a single column in a European version of Excel. Use a semicolon there.
Doing it in a spreadsheet instead
Excel 2019 and Microsoft 365 have the TEXTJOIN function, and Google Sheets has TEXTJOIN and JOIN, which join a range of cells with a separator. For the reverse, Excel has "Text to Columns" and Google Sheets has SPLIT. Those are fine for a quick join, but quotes, escaping, duplicates, sorting and formats such as SQL or regex need extra formulas. This tool does all of that in one place and shows the result immediately.
Privacy and large lists
The comma separator runs entirely in your browser with JavaScript. Your list is not uploaded to our server, so you can use it for customer IDs, email addresses or internal URLs. Very long lists work too; for inputs over a few hundred thousand characters the tool waits a moment after you stop typing before it rebuilds the result.
Frequently asked questions
How do I convert a column to a comma-separated list?
Paste the column into "Column data". The comma-separated list appears in "Delimited data" right away, joined with a comma and a space. Click "Copy result" to copy it.
How do I convert a comma-separated list back into a column?
Paste the line into "Delimited data", check that the menu between the boxes shows the comma, and click the left arrow ("Delimited to column"). Or paste it into the left box and click "One per line".
Can I add quotes around each item?
Yes. In "2. Shape each item", choose double or single quotes. Quotes inside an item are doubled, or escaped with a backslash if you tick that option.
How do I remove duplicates from a list?
Tick "Remove duplicates" in "1. Read the list". The first copy of each item is kept, and the counter under the result shows how many were removed.
Can I use a separator other than a comma?
Yes. Choose semicolon, pipe, tab, space or new line, or choose "Other" and type any text. Use \n for a line break and \t for a tab.
Is there a limit to the number of items?
The tool sets no fixed limit. Because it runs in your browser, the practical limit is your device's memory, and lists of many thousands of lines work normally.
Is my data sent anywhere?
No. The conversion happens in your browser and nothing is sent to our server. The tool is free and needs no sign-up.