A colleague sends you 300 order numbers in a spreadsheet column and asks you to look them up. The database query wants them as 'A1001', 'A1002', 'A1003'. The search filter in your CRM wants them separated by commas. The email to the supplier should list them on one line. The data is right; the shape is wrong.
This guide explains the common list formats, what can go wrong when converting between them, and how to switch a column to a delimited list, or a delimited list back to a column, with a browser tool, spreadsheet formulas or a text editor.
Lists, delimiters and why the shape matters
A list can be stored in two basic shapes:
- Vertical: one item per line. This is what you get when you copy a column from Excel or Google Sheets, export a report, or paste from many web pages.
- Delimited: items on one line separated by a character, usually a comma. This is what SQL
IN (...)clauses, tag fields, URL parameters, many search boxes and email recipient fields expect.
The separator is called a delimiter. Commas are most common, but semicolons are standard in some regions and apps (Outlook recipient lists, for example, and CSV files in countries that use the comma as a decimal mark). Pipes (|) and tabs appear in data exports because they rarely occur inside the values themselves.
When items contain the delimiter
The classic trap is a value that contains a comma: Smith, John or Unit 4, High Street. Joined with commas, that single item becomes two. The standard solution, used by CSV files, is to wrap each item in double quotes: "Smith, John", "Doe, Jane". If a value itself contains a quote, it is doubled ("The ""Big"" Deal"), which is exactly how spreadsheet software reads it back.
Convert a list in your browser
Our Comma Separator handles both directions and the details above.
Column to comma-separated
- Open Comma Separator and keep the mode on List → comma separated.
- Paste your column into List (one item per line).
- Choose Join items with: Comma + space, Comma, Semicolon, Pipe, Tab, Space, New line, or Custom… (for example
ORto build a search query). - Under Wrap each item in, choose No quotes, Double "item" or Single 'item'. Single quotes suit SQL string values; double quotes suit CSV.
- Use the switches as needed: Trim spaces, Skip empty items, Remove duplicates and Sort A → Z.
- Copy the result from Comma-separated values or click Download. The summary shows how many items are included.
Comma-separated back to a column
- Switch to Comma separated → list.
- Paste the delimited text and choose what to Split items on.
- Quoted items are respected, so
"Smith, John"stays one item rather than splitting at its internal comma. - Copy the one-per-line result, ready to paste into a spreadsheet column.
When splitting on Comma + space, the tool splits on the bare comma and trims the spaces, because real-world lists are rarely consistent about the space after each comma.
Other ways to do it
Excel and Google Sheets: TEXTJOIN
Current versions of Excel and Google Sheets include TEXTJOIN, which is the neatest built-in method:
=TEXTJOIN(", ", TRUE, A2:A301)
The TRUE argument skips empty cells. To add quotes, combine it with concatenation, for example in Google Sheets:
=TEXTJOIN(", ", TRUE, ARRAYFORMULA("'" & A2:A301 & "'"))
In Excel 365, ="'"&A2:A301&"'" inside TEXTJOIN spills naturally. Older Excel versions without TEXTJOIN need a helper column or the CONCATENATE function cell by cell, which is tedious for long lists.
To go the other way, Data → Split text to columns (Sheets) or Text to Columns (Excel) splits a cell on a delimiter, and TRANSPOSE can flip the result from a row into a column. SPLIT in Google Sheets does the same with a formula.
Spreadsheets are the better choice when the list is already in a sheet and you need the result to update automatically as the data changes.
Text editors
In any editor with regex find and replace, replace \n with , to join lines. Adding quotes takes a second pass that replaces ^ with ' and $ with ', or you can use the multi-cursor features in editors like VS Code. Add Prefix & Suffix to Lines does the quoting part in one step if you prefer.
Command line
paste -sd, items.txt joins lines with commas on macOS and Linux. tr ',' '\n' splits them back. Neither handles quoted commas, so they suit clean data such as IDs.
Tips and common mistakes
Invisible spaces break lookups
Values copied from spreadsheets and web pages often carry trailing spaces, so A1001 does not match A1001 in a database. Keep Trim spaces on.
Duplicates inflate the list
Exports frequently repeat values. Remove duplicates keeps the first occurrence of each item. For duplicate removal on its own, including case-insensitive matching, see Remove Duplicate Lines.
Numbers do not need quotes in SQL
For numeric IDs, use No quotes: WHERE id IN (101, 102, 103). For text values, use single quotes. Mixing them up can cause type errors or slow queries, depending on the database.
Very long lists
Some systems limit how many values an IN clause, URL or search box accepts. If you hit a limit, split the list into chunks. For data that is really a table rather than a list, a proper converter such as CSV to JSON handles columns and headers correctly.
Semicolons for email recipients
If you are building a recipient list for an email client, check whether it expects commas or semicolons; many desktop clients accept semicolons most reliably. Our Email Extractor can pull the addresses out of messy text first.
Frequently asked questions
How do I convert an Excel column into a comma-separated list?
Copy the column, paste it into a list-to-CSV tool, and choose a comma as the delimiter. In Excel itself, =TEXTJOIN(", ", TRUE, A2:A100) does the same in current versions.
How do I split a comma-separated list into separate lines?
Use the Comma separated → list mode, or Text to Columns in a spreadsheet followed by a transpose. Quoted items that contain commas stay together in our tool.
How do I add quotes around each item?
Choose Single 'item' or Double "item" under Wrap each item in. Quote characters inside an item are doubled, following the CSV convention.
Can I use a separator other than a comma?
Yes. Semicolon, pipe, tab, space and new line are built in, and Custom… accepts any text, including \n and \t.
Does the tool sort or remove duplicates?
Only if you ask. Remove duplicates keeps the first occurrence of each item, and Sort A → Z sorts naturally so that item2 comes before item10.