Menu

Comma Separator

Paste one item per line to get a comma-separated list such as 1001, 1002, 1003, or switch to List → column to split a list back into one item per line.

0 words 0 characters 0 lines

Convert

Continue with this text: Add prefix/suffixRemove duplicatesSort lines

Your text stays in your browser: nothing is uploaded or stored on a server.

How to use the comma separator

  1. Choose the direction under Convert: Column → list joins lines into one list, List → column splits a list into lines.
  2. Paste your items into Your items, or click Example to load five order numbers. Open file reads .txt, .csv and similar plain-text files.
  3. Pick a Separator, and for Column → list, choose Quotes and Wrap if the list goes into code or SQL.
  4. Leave Trim spaces and Skip empty lines on unless you need the spaces or blanks. Tick Remove duplicates to keep only the first copy of each item.
  5. The result updates as you type, with the number of items next to it. Click Copy, Download .txt, or Use as input to keep working on it in another tool.

What each option does

Option Choices What changes
Separator Comma and space, Comma, Semicolon, Tab, Pipe, Space, New line The text put between items. Default: comma and space.
Quotes None, Double “a”, Single ‘a’ Puts each item in quotes.
Wrap Nothing, ( … ) for SQL IN, [ … ] for arrays Adds brackets around the whole list.
Trim spaces On by default Removes spaces and tabs at the start and end of each line.
Remove duplicates Off by default Keeps the first copy of each item, in the original order.
Skip empty lines On by default Leaves blank lines out instead of producing empty items such as a, , b.

The options are applied in that order: trim, skip empty lines, remove duplicates, then add quotes, separators and brackets. Duplicates are therefore compared after trimming, and an item that is only spaces counts as empty when trimming is on. Quotes, Wrap, Remove duplicates and Skip empty lines only affect Column → list.

A line is ended by any kind of line break (Windows, Mac or Unix), so a column copied from a spreadsheet on any system splits correctly. Accented letters and emoji pass through unchanged: café, naïve and 😀 with double quotes give "café", "naïve", "😀".

Quotes, escaping and SQL IN lists

Text values in SQL need quotes; numbers do not. The quote option also escapes a quote that is already in an item, so the list stays valid:

Item Quotes Becomes
O'Brien Single ‘a’ 'O''Brien'
say "hi" Double “a” "say \"hi\""

A doubled single quote is the SQL way to write an apostrophe inside a string. A backslash before a double quote is how JSON, JavaScript and Python write it. CSV files use a different rule (a doubled ""), so for a CSV line with quotes in the data, check the result before using it.

For a Python list, use double quotes: Python does not read '' inside single quotes as an apostrophe.

Turning a list back into a column

In List → column mode the tool:

  • removes one opening ( or [ at the start and one closing ) or ] at the end of the whole text;
  • splits at the chosen separator and always at line breaks, so a list that runs over several lines (a, b on one line, c, d on the next) gives four items. For Comma and space and Comma it splits at every comma, with or without a space after it; Semicolon and Pipe likewise split at every ; or |, with or without spaces around it. New line splits only at line breaks;
  • keeps an item together when it starts with a double quote, even if it contains the separator: "Smith, John", "Doe, Jane" gives Smith, John and Doe, Jane. A single quote does the same when a matching closing quote ends the item, so 'Smith, John', 'Doe, Jane' (the tool’s own Single ‘a’ output) also gives Smith, John and Doe, Jane;
  • trims spaces around each item (if Trim spaces is on) and removes a matching pair of " or ' around it, undoing the escaping Column → list adds: 'O''Brien' gives O'Brien, and "say \"hi\"" gives say "hi" (a CSV-style "" inside double quotes also becomes ");
  • always drops empty items, so a,,b, ,c gives three lines.

Some lists need care:

  • A leading apostrophe is ordinary text. If no closing quote ends the item, a single quote at the start is kept and does not protect a separator: '90s, rock gives '90s and rock. To keep such text whole, put the item in double quotes with Replace text first, or choose a separator that does not occur in the data.
  • Numbers with thousands separators such as 1,000 are split at the comma unless they are in quotes ("1,000" or '1,000') or the list uses another separator.

Worked examples

The default settings with the built-in example:

1001
1002
1003
1004
1005

give 1001, 1002, 1003, 1004, 1005 (5 items).

A pasted email column with a blank line and a repeat, with Single quotes, ( … ) and Remove duplicates:

[email protected]
[email protected]

[email protected]
[email protected]

gives ('[email protected]', '[email protected]', '[email protected]') (3 items), ready for WHERE email IN ….

Before Settings After
apple / banana / cherry (3 lines) Double “a”, [ … ] ["apple", "banana", "cherry"]
Paris / London / blank / Tokyo Defaults Paris, London, Tokyo
red / Red / red Remove duplicates red, Red
a / b / c Separator Pipe a | b | c
('1001', '1002', '1003') List → column 1001 / 1002 / 1003 (3 lines)

When people need it

  • Database queries. A list of order numbers or customer IDs from a report becomes an IN (…) filter.
  • Code. Test data or a list of country codes becomes a JavaScript, JSON or Python array.
  • Marketing and SEO. A column of keywords or tags becomes one line for a tag or keyword field that takes comma-separated values; the reverse turns such a field back into a list you can sort or dedupe.
  • Email. A column of addresses from a spreadsheet becomes one line you can paste into the To or Bcc field.
  • Spreadsheets. A comma list from an email or a form becomes a column you can paste into Excel or Google Sheets, one item per row.

Doing the same in Excel

Excel 2019 and later, and Excel for Microsoft 365, can join a range with TEXTJOIN: =TEXTJOIN(", ", TRUE, A1:A100) uses a comma and a space and skips empty cells. If the result is longer than 32,767 characters, the cell limit, the formula returns #VALUE!; this tool has no such limit.

To go the other way, Excel’s Data > Text to Columns wizard (choose Delimited, then the delimiter) splits a cell into columns side by side, not rows. If you need one item per row, split the list here and paste the result into the column.

Questions

How do I turn a column into a comma-separated list?

Copy the column (from Excel, Google Sheets, a CRM export or a text file), paste it into the box with Column → list selected, and copy the result. Each line becomes one item, joined with a comma and a space by default.

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

Choose Single 'a' under Quotes and ( … ) for SQL IN under Wrap. Three lines A12, B7 and C3 become ('A12', 'B7', 'C3'). For numeric IDs, leave Quotes on None.

How do I split a comma-separated list into separate lines?

Select List → column, keep the separator on Comma and space or Comma, and paste the list. Spaces around each item, outer quotes and surrounding brackets are removed, and each item goes on its own line.

Can I do this in Excel without a tool?

In Excel 2019 or later and Microsoft 365, =TEXTJOIN(", ", TRUE, A1:A100) joins a range with a comma and a space and skips empty cells. The result must fit in one cell, which holds at most 32,767 characters.

What happens to names with apostrophes, such as O'Brien?

With single quotes, an apostrophe inside an item is doubled, so O'Brien becomes 'O''Brien', which is how SQL writes a quote inside a string. With double quotes, a " inside an item becomes \".

Does "Remove duplicates" ignore upper and lower case?

No. Items must match exactly, so red and Red are both kept. With Trim spaces on, red and red count as the same item. For case-insensitive matching, run the column through Remove duplicate lines first.

Can it add commas to large numbers, like 1,000,000?

No. This tool puts commas between items, not thousands separators inside numbers. In List → column mode it splits 1,000 into 1 and 000 unless the number is in quotes ("1,000" or '1,000'), so put such numbers in quotes or use Semicolon or New line lists.

Is my list uploaded anywhere?

No. The conversion runs in your browser. The text is kept only in this browser tab so it is still there if you open another tool, and your option choices are remembered on this device.