Comma Separator

Turn a column into a comma separated list, and back.

  • Text Tools
  • Free, no sign-up
  • Runs in your browser

Comma Separator tool

About the Comma Separator

A column copied from a spreadsheet has one item per line, while SQL queries, code, email fields and many forms want a single comma separated list. This comma separator converts in either direction, with your choice of delimiter, optional single or double quotes around each item, trimming of stray spaces and removal of blank lines and duplicates along the way.

When joining, each line becomes one item; leading and trailing spaces are trimmed if you ask, empty lines are skipped, and duplicates are removed keeping the first occurrence. Quotes inside an item are escaped by doubling them, which is what SQL and CSV expect, so O'Brien in single quotes becomes 'O''Brien'. When splitting, the text is cut at every delimiter, surrounding quotes are removed and each item is placed on its own line.

Example: the lines apple, banana and cherry become "apple, banana, cherry" with the default comma and space, or 'apple','banana','cherry' with single quotes and a plain comma, ready for an SQL IN (…) clause. Splitting "red; green; blue" with the semicolon delimiter gives three lines.

To clean the list first, use remove duplicate lines and the text sorter. For structured data, the CSV to JSON converter and JSON to CSV converter handle full tables.

How to use the Comma Separator

  1. Choose the directionJoin lines into a list, or split a list into lines.
  2. Paste your itemsA column from a spreadsheet, or a comma separated list.
  3. Set the formatDelimiter, quotes, trimming, blank lines and duplicates.
  4. Copy the resultPaste it into your query, code or form.

Comma Separator features

  • Column to comma separated list
  • Comma list back to a column
  • Comma, semicolon, pipe, tab, space or custom delimiter
  • Double or single quotes, with escaping
  • Trim spaces and remove blank lines
  • Remove duplicates
  • Swap direction with one click

Common uses

  • SQL IN clauses
  • Email recipient lists
  • Tags and keyword lists
  • Arrays in code
  • Cleaning spreadsheet exports

Converting between lists and comma-separated text

By the FreeToolsWorld editorial team · Updated November 2026 · How we write and check our guides

Lists live in two common shapes: one item per line, as in a spreadsheet column, and items joined with commas, as in a CSV row, a tag field or a code array. Moving data between apps often means converting from one shape to the other, and adding quotes or removing duplicates along the way. This guide explains the conversions, the delimiter choices and the pitfalls with commas inside items.

Lines to comma-separated

Pasting a column copied from a spreadsheet gives one item per line. Joining them with ", " produces a single line such as apple, banana, cherry, ready for a tag field, an email list or a sentence. For code and data, wrapping each item in quotes gives "apple", "banana", "cherry", which can be pasted straight into an array or an SQL IN (...) clause.

Comma-separated to lines

The reverse is just as common: a long line of tags, keywords or email addresses that you need as a column to paste into a spreadsheet or to sort and deduplicate. Splitting on commas puts each item on its own line, trimming the spaces that usually follow each comma.

Choosing a delimiter

DelimiterTypical use
Comma and spacereadable lists, tags, sentences
Comma onlyCSV data, code arrays
Semicolonemail recipient lists in some programs, CSV in some regions
Tabpasting into spreadsheets across columns
Pipe or spacecommand lines, search queries, hashtags

Some countries use the comma as a decimal mark, so their spreadsheet software exports CSV files with semicolons instead of commas. If a list will be opened in such software, a semicolon delimiter avoids splitting numbers like "3,5" in half.

Items that contain commas

An item such as "Smith, John" or "London, UK" contains a comma, so a simple split would cut it into two. CSV solves this by wrapping such items in double quotes: "Smith, John". When converting lines that may contain commas into CSV, always quote the items. When splitting text that uses quoted items, make sure the tool respects the quotes, or use a dedicated CSV tool such as CSV Formatter.

Removing duplicates and blanks

Lists assembled from several sources often contain repeats and empty entries. Removing duplicates during the conversion gives a clean result in one step. For more control over how duplicates are matched, such as ignoring case, use Remove Duplicate Lines first.

Email recipient lists

Most email programs accept several addresses separated by commas or semicolons in the To, Cc and Bcc fields. When sending to many people who do not know each other, put them in Bcc so their addresses stay private. To pull addresses out of a messy block of text before joining them, use Email Extractor.

A worked example: tags for a blog post

A blogger has keywords from a research spreadsheet: twelve lines, two of them duplicates and one blank. Converting lines to a comma-separated list with duplicates removed gives sourdough, starter, hydration, levain, crumb, scoring, banneton, proofing, bread flour, ready to paste into the tags field. The same list with quotes and no spaces becomes "sourdough","starter",... for a developer to add to a JSON file.

Preparing lists for code

Developers often need a list of values as a code array. Quote each item, join with commas, and wrap the result in brackets. Check for quotes inside items, which must be escaped, and for trailing commas, which some languages reject.

Hashtags and keyword strings

For social media, convert a list of words into hashtags by adding a # with Add Prefix and Suffix to Lines and then join them with spaces. Remove spaces inside each item first, because hashtags cannot contain spaces.

Common mistakes

  • Splitting text that has commas inside items, creating extra pieces.
  • Forgetting to trim spaces, leaving " banana" with a leading space.
  • Using commas for software that expects semicolons.
  • Leaving duplicates in lists meant for unique values.

Splitting on other separators

Not every list arrives separated by commas. Exports from some programs use semicolons, pipes or tabs, and lists written by people often use "and" before the last item, as in "red, green and blue". Choose the separator that matches the input before splitting, and replace a final " and " with a comma first if the list was written as a sentence. Mixed separators are common in pasted data, so a quick find-and-replace that turns every semicolon into a comma gives the splitter one consistent character to work with.

Blank items and trailing commas

Double commas such as "apple,,banana" create an empty item between them, and a trailing comma at the end of a line creates one more. Lines copied from Windows programs may also end with an invisible carriage return that sticks to the last item. Removing empty items and trimming each one fixes all three problems. When the list is going into code, check the result once more, because an empty string in an array or a stray comma at the end can cause errors that are hard to spot later.

Privacy

Conversions run in your browser. Lists of emails, customer names or product data are never uploaded.

Frequently asked questions

How do I convert a column to a comma separated list?

Copy the column from Excel or Google Sheets, paste it here, and the items are joined with commas at once. Choose another delimiter or add quotes in the options, then copy the single line.

How do I make a list for an SQL IN clause?

Choose single quotes and a plain comma. The column becomes 'a','b','c', and any single quotes inside items are doubled, as SQL requires. Wrap it in IN ( … ) in your query.

How do I split a comma separated list into lines?

Switch the direction to split, paste the list and choose the delimiter it uses. Each item appears on its own line, with surrounding quotes and spaces removed.

How do I turn a list into comma separated values in Excel?

Excel's TEXTJOIN function does it: =TEXTJOIN(", ", TRUE, A1:A100). This tool does the same without formulas and adds quotes, trimming and duplicate removal.TEXTJOIN is available in Excel 2019 and Microsoft 365.

Can I remove duplicates at the same time?

Yes. Turn on remove duplicates and repeated items are dropped, keeping the first occurrence of each. Trimming spaces first makes sure items with stray spaces still match.

What delimiter should I use?

Commas for most lists, semicolons where commas appear inside items or in European CSV files, pipes for readability in logs, and tabs to paste back into a spreadsheet as columns.

Why are some items in quotes doubled?

Items that contain the quote character are escaped by doubling it, so "6" monitor" becomes "6"" monitor". That is the standard escaping for CSV and SQL strings.

Is there a limit on the list size?

No fixed limit. The conversion runs in your browser and handles tens of thousands of items quickly, and the data is never uploaded.Very large lists may take a second to update.

How do I convert a comma separated list into a column in Excel?

Paste it into one cell, then use Data, Text to Columns with comma as the delimiter and transpose the result, or paste it here, split it into lines and paste those lines straight into a column.