Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Comma Separated List Converter

Column to comma list and back — or SQL IN, JSON, Python and CSV — in one paste.

Text No upload Works offline Free, no sign-up

Paste a list or drop a text or CSV file on the box. Nothing leaves your device.

Clean up

Convert to

Quotes

Next steps

About the Comma Separated List Converter

Paste a list in any shape — a column copied from Excel or Google Sheets, a comma-separated line, a JSON array, a Python list or the inside of a SQL IN (…) — and get it back in the shape you need: one item per line, separated by commas or any other delimiter, wrapped in quotes, as a ready-made SQL IN (…) clause, a JSON array, a Python list or a correctly quoted CSV row.

On the way, it can trim stray spaces, drop empty items, remove duplicates (with or without ignoring capitals, handy for keyword lists) and sort A → Z with numbers in order. Each output follows the target’s own quoting rules, so a name like O’Brien or a value with a comma inside never breaks your query, code or spreadsheet.

How to use it

  1. Paste your list, or open a .txt or .csv file. The tool detects how it is separated and says what it found; pick another option under Split items on if needed.
  2. Choose the clean-up: Trim spaces, Remove empty items, Remove duplicates (optionally ignoring capitals) and a Sort order.
  3. Pick the output: List (any delimiter, quotes and brackets), SQL IN, JSON, Python or CSV, and set its options.
  4. Press Copy, or Download the result as a file. Use as input lets you convert the result again.

Examples

A column from a spreadsheet to a comma-separated line
Input
Delhi
Mumbai
Chennai
Kolkata
Result
Delhi, Mumbai, Chennai, Kolkata
SQL IN clause with a column name

Single quotes inside a value are doubled, as SQL requires.

Numbers to a JSON array
Input
101, 102, 103
Result
[101, 102, 103]

Every item is a number, so the numbers are written without quotes.

A Python list back to one item per line
Input
['red', 'green', "it's blue"]
Result
red
green
it's blue
Values with commas as a CSV row
Input
Smith, John
Doe, Jane
Result
"Smith, John","Doe, Jane"

Common uses

  • Turning an Excel or Sheets column of IDs, SKUs or email addresses into a SQL WHERE … IN (…) filter.
  • Cleaning and de-duplicating keyword, tag or hashtag lists before importing them into an ads or SEO tool.
  • Converting a column into a JSON array or Python list for test data, configuration or code.
  • Joining a list with semicolons for email recipients, or with pipes and tabs for other software.

How the list is read

With Detect automatically, the tool first checks whether the text is a list written in code: square brackets [ … ] are read as a JSON array or Python list (with their escapes, such as \n and \"), and ( … ), IN ( … ), column NOT IN ( … ) or a whole SELECT … WHERE, UPDATE … WHERE or DELETE … WHERE query ending in IN ( … ) as a SQL list (where '' stands for one quote). Ordinary text whose last line merely ends in “in (…)” is not taken for SQL, and a query with two IN lists is split like ordinary text rather than keeping just one of them. Otherwise:

  • Text with two or more lines is split into lines. If most lines also contain commas, semicolons or tabs, a hint suggests splitting on those as well — a list of “Last, First” names should stay one name per line.
  • A single line is split on tabs if it has any (a row copied from a spreadsheet), otherwise on whichever of commas, semicolons or pipes appears most often, and otherwise on spaces.

With Remove quotes around items on, a value in double quotes may contain the delimiter ("Smith, John" stays one item, and "" inside it is one quote, as in CSV files), and one pair of matching quotes — straight, curly or backticks — is removed from each item (a doubled quote inside, such as 'O''Reilly', becomes one). A line that holds several quoted values, such as "a","b", keeps its quotes: split on New lines, commas, semicolons and tabs to separate them.

Quoting rules for each output

  • SQL IN: text values are put in single quotes and any single quote inside is doubled (O'Brien becomes 'O''Brien'), which is standard SQL. MySQL and MariaDB also treat a backslash as an escape character by default, so tick Double backslashes for them. Numbers are left unquoted only when every item is a plain number; values such as 007 keep their quotes so leading zeros survive.
  • JSON: strings are escaped as RFC 8259 requires (quotes, backslashes and control characters). Numbers are written as numbers when every item is one, unless a number has more than 15 significant digits, which JavaScript would round — then everything stays a string.
  • Python: strings are written the way Python’s repr() writes them, in single quotes unless the text contains a single quote, with \n, \t, \xa0 and similar escapes for invisible characters.
  • CSV: fields are quoted only when they contain the separator, a double quote, a line break or leading or trailing spaces, and quotes inside are doubled (RFC 4180). Choose a semicolon separator for spreadsheets set to languages that use a decimal comma.

Long IN lists

Oracle Database accepts at most 1,000 values in one IN list and stops with error ORA-01795 above that. Enter a column name and set Values per group to 1,000: the tool writes (id IN (…) OR id IN (…)), or (id NOT IN (…) AND id NOT IN (…)) for NOT IN, which means the same thing. For very long lists, a temporary table or a join is usually faster than a huge IN list in any database.

Limitations

  • Only flat lists are read: a JSON array of objects or nested arrays, or a CSV file with several columns, is treated as text. To get every cell of a table as one list, split on New lines, commas, semicolons and tabs.
  • The SQL output is meant for one-off queries in a database console or script. In application code, pass values as query parameters instead of building SQL text.
  • CSV cells are written exactly as your items are. Spreadsheet apps may run a cell that starts with =, +, - or @ as a formula, so the tool warns when an item starts that way.
  • Duplicates are compared after trimming (when on) and Unicode normalisation; Ignore capitals also treats letters such as ß and SS as the same.
  • Files up to 50 MB can be opened; very large lists may take a moment to sort.

Privacy

Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.

Frequently asked questions

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

Select the cells in Excel or Google Sheets, copy them and paste them here. Each cell arrives on its own line, and the List output joins them with a comma and a space. Choose another separator, or add quotes around each item, under the List options.

How do I create a SQL IN clause from a list?

Paste the values, choose SQL IN, and optionally type the column name. Text values are quoted and escaped; numbers stay unquoted when every value is a number. Tick NOT IN to exclude the values instead.

How do I add quotes around every item?

Choose the List output and pick double or single quotes. Quotes that already appear inside an item are doubled so the result stays valid. For code, the JSON and Python outputs quote and escape each item correctly for those languages.

Can I turn a comma-separated list back into one item per line?

Yes. Paste the comma-separated text, choose the List output and set the separator to New line. JSON arrays, Python lists and SQL lists are read the same way.

Why are my numbers in quotes?

Numbers are written without quotes only when every item is a plain number such as 42, -3.5 or 1e6. One text item, a value with a leading zero (007) or a thousands separator (1,000) keeps everything quoted, so the types stay consistent. You can also turn Numbers without quotes off.

Is my list uploaded anywhere?

No. Everything happens in your browser, including opened files, so it is safe for customer lists, emails and internal IDs.

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.