List to Comma Separated Converter
Paste a list with one item on each line and get one line with the items separated by a comma, a semicolon, a pipe, a tab or any delimiter you type. Put quotes around each item, wrap the list in brackets, remove duplicates and sort it. Ready-made formats make a SQL IN list, a JSON array, a Python list or a CSV row in one click. Switch to List to lines to split a comma separated list back into one item per line. Everything runs in your browser.
5 items
Lines to a list puts every line on one line with the delimiter you choose between them. The ready-made formats set everything at once: the SQL IN list puts single quotes around the text and leaves numbers bare, doubles a quote inside an item, as in O''Brien, and wraps the list in parentheses, ready for WHERE name IN followed by the result. The JSON array uses double quotes with a backslash before any quote or backslash inside an item, and the Python list uses single quotes in square brackets. Duplicates are removed keeping the first, and sorting puts item2 before item10. List to lines does the reverse: it splits at the delimiter, does not split at one that is inside quotes, removes the quotes and any brackets around the whole list, and puts one item on each line. Everything runs in your browser.
Related Tools
[5 suggestions]Text Splitter: Split Text into Parts by Characters, Words, Lines or a Delimiter
Split long text into parts of a set number of characters, words, lines or sentences, or at a delimiter. Break at spaces, number the parts as (1/5), and copy each one.
Line & ListsRemove Duplicate Lines
Strip repeated lines from any block of text while preserving initial ordering.
Line & ListsSort Lines
Sort lines alphabetically (A-Z or Z-A) or by character length with one click.
Line & ListsPrefix / Suffix Adder
Add text to the start and end of every line: quote and comma a list, or build a SQL IN list or a JSON array.
Line & ListsRemove Line Breaks
Strip line breaks and paragraph breaks from text, or join broken lines into clean paragraphs.
Line & ListsAbout the List to Comma Separated Converter
The most common job is turning a column copied from a spreadsheet into something a program can read. The SQL IN list puts single quotes around each item, leaves numbers bare, doubles any single quote inside an item the way SQL expects, so O'Brien becomes 'O''Brien', and wraps the whole list in parentheses, ready to paste after WHERE name IN. The JSON array uses double quotes and puts a backslash before any double quote or backslash inside an item, so the result is valid JSON. The Python list uses single quotes in square brackets. Items are trimmed and empty lines are skipped by default, and you can remove duplicates, keeping the first one, with or without ignoring case. Sorting is natural, so item2 comes before item10, and it ignores case first. The delimiter can be typed as a backslash and an n for a new line or a backslash and a t for a tab. List to lines works the other way: it splits at the delimiter but not at one that is inside quotes, so 'cherry, red' stays one item, removes the quotes around each item and the brackets around the whole list, undoes doubled quotes, and puts one item on each line. A list joined as a SQL IN list splits back into the original items.
How do I turn a column into a comma separated list?▾
Paste the column, one item per line, and the result appears on one line with a comma and a space between the items. Choose another delimiter or quotes if you need them, then copy the result.
How do I make a SQL IN list?▾
Click the SQL IN list format. Each item gets single quotes, numbers stay bare, a quote inside an item is doubled, and the whole list is wrapped in parentheses. Paste it after WHERE column IN.
How do I make a JSON array from a list?▾
Click the JSON array format. Items get double quotes, a quote or backslash inside an item is escaped with a backslash, numbers stay bare and the list is wrapped in square brackets, so the result is valid JSON.
Can it remove duplicates and sort?▾
Yes. Turn on Remove duplicates to keep the first of each item, with or without ignoring case, and choose A to Z or Z to A. Sorting is natural, so item2 comes before item10.
Is my list uploaded?▾
No. The list is converted in your browser and nothing you paste is sent anywhere.