Convert lines to a comma-separated list in one click
Paste a column from a spreadsheet or any text with one item per line and this tool will convert the lines to a comma-separated list, using a comma, semicolon, pipe, tab, space or a separator of your own. Switch the direction to turn a comma separated list back into lines, even when some items are quoted.
Quotes, brackets, sorting and duplicates for lists and code
Wrap every item in single or double quotes, put the whole list in brackets, remove empty items and duplicates, sort A to Z or by number, and break the list into rows of any length. That makes it a quick way to build an SQL IN list, an array for code, a list of tags or e-mail addresses, or to convert a column into a comma separated string for a form.
How to use Lines to Comma-Separated List Converter
- Choose the direction: lines to a list, or a list back to lines.
- Paste your items into the box and set the separator, quotes and brackets.
- Tick the options for trimming, empty items, duplicates and sorting, then solve the security check and press Convert.
- Copy the result, download it, or use Swap to run the result back the other way.
About Lines to Comma-Separated List Converter
In the lines to list direction every line is one item. Items are trimmed, empty lines are removed, duplicates can be dropped and the items can be sorted before they are joined with the separator. Quotes inside an item are doubled, as SQL and CSV expect, or escaped with a backslash, as JSON and most code expect. In the list to lines direction the list is split at the separator, quoted items that contain the separator stay in one piece, and the quotes and the outer brackets can be stripped. Auto detect splits at commas, semicolons, pipes and tabs. Sorting is natural, so item 2 comes before item 10, and number sorting compares the values.
Purpose of Lines to Comma-Separated List Converter Tool
Use it to build an SQL IN list from a column of ids, to make an array for JavaScript, Python or PHP, to prepare e-mail addresses, tags or keywords for a form, to move a spreadsheet column into a text field, or to split a pasted list back into one item per line.
Limitations of Lines to Comma-Separated List Converter
- Items that contain the separator, such as a name with a comma, should be put in quotes or you should choose another separator.
- The converter does not check what the items mean. Numbers, ids and text are all handled as plain text.
- A list with unbalanced quotes may be split in the wrong place, so check the first and the last items.
- Text over 2 million characters is refused to keep the page fast.
Privacy and data
Lines to Comma-Separated List Converter runs entirely in your browser. What you type or select is processed on your own device and is never sent to or stored on our server. See our Privacy Policy for details.
Frequently asked questions
How do I convert lines to a comma-separated list?
Paste your lines, keep the direction on Lines to list, choose the comma separator, solve the security check and press Convert. Copy the list in one click.
How do I make an SQL IN list?
Choose single quotes, round brackets and the comma separator, then convert your ids. The result looks like ('a', 'b', 'c') and is ready to paste into a query.
Is the lines to comma separated list converter free and safe to use?
Yes. The lines to comma separated list converter is free to use and runs in your browser, so your text is not uploaded, stored or logged.
How do I convert a comma separated list back to lines?
Switch the direction to list to lines, paste the list and convert. Each item goes on its own line.
How do I put quotes around each item in a list?
Choose single or double quotes before you convert. Every item is wrapped in them, which is handy for SQL, JSON and code arrays.
Rate Lines to Comma-Separated List Converter
No ratings yet. Be the first to rate this tool.
Report a bug or give feedback
Popular tools
Morse Code to Text
Decode Morse code made of dots and dashes into readable text, with flexible separators and error marking.
Text ToolsWebpage URL to Text
Turn a web page address, pasted page source or an HTML file into clean readable text without ads and menus.
Text ToolsASCII to Text Converter
Decode decimal, hex or octal ASCII codes into text, with auto-detection, a code table, control-character names and clear errors for bad codes.
Text ToolsBinary to Text Converter
Decode binary into text as UTF-8, 7-bit ASCII or 16-bit UTF-16, with or without spaces, and find exactly what is wrong when it will not decode.
Text ToolsBMI Calculator
Work out your BMI, category and healthy weight range in metric or imperial units.
Health ToolsBullet List Generator
Turn lines, commas or sentences into a bullet, numbered or checklist, with nested levels, as text, Markdown or HTML.
Text Tools