Convert a list of lines to a comma separated list

Paste a column of lines and get one comma separated row. Nothing leaves your browser.

A column copied from a spreadsheet or a text file has one item per line, but many places want the items on a single row: an email list, a search box, a tag field or the list of values inside a SQL IN clause. This page opens with From set to new line and To set to comma, so each line becomes one item and the items are joined as a,b,c with no spaces. Choose Wrap each item in quotes to get 'a','b','c' or "a","b","c", which is the form most query lists and code arrays need. Blank lines are dropped by default, so a gap in your column does not leave two commas in a row, and spaces around each line are trimmed. Windows and Unix line endings both work. One honest limit: the page does not escape quote marks that are already inside an item, so check items that contain an apostrophe. The box opens with a short column of lines as a sample, so replace it with your own column.

How it works

  1. Paste your list
  2. Choose the delimiter it has now and the one you want
  3. Copy the converted list

Frequently asked questions

How do I get a comma and a space between items?

Set To to Comma and space. The result then reads a, b, c instead of a,b,c. Everything else, such as trimming and quotes, works the same.

Can I make a list for a SQL IN clause?

Choose Single under Wrap each item in quotes and keep To on comma. Lines apple and pear become 'apple','pear'. Add the parentheses yourself, and check any item that holds an apostrophe, because quote marks already in the text are not escaped.