List Converter (Lines and Comma Separated)
Turn one-item-per-line text into a comma separated list, with optional quotes, or split a list back into lines. Remove blanks and duplicates too.
Turn one-item-per-line text into a comma separated list, with optional quotes, or split a list back into lines. Remove blanks and duplicates too.
Pasting a column from a spreadsheet into a SQL IN clause or an array needs commas and quotes around each item. This tool does that in one step, and reverses it.
You can also drop blank lines and duplicates while you convert.
apple banana cherry 'apple', 'banana', 'cherry'
Many systems expect lists in a specific shape. SQL IN clauses need comma separated values with single quotes around strings, JSON arrays need double quotes and brackets, and shell loops often want one item per line. Converting by hand is error prone, especially a missing comma on the last line. Splitting a column of lines on the newline character and joining with a chosen delimiter solves this mechanically. Trimming whitespace around each item matters because trailing spaces copied from spreadsheets become part of the value and can silently cause a lookup to fail.
Quoting needs care. Wrapping items in single quotes works for simple values, but a value that itself contains a single quote must be escaped for SQL, usually by doubling it, so check names such as O'Brien before running a query. Numbers should be left unquoted in most databases. Removing duplicates keeps the first occurrence and preserves order, which is usually what you want, while sorting would be a separate step. Very long IN lists may hit database limits, such as the maximum number of parameters or query length, so consider a temporary table for thousands of values.
Yes. Type it in the Separator box, for example ; or |. Use \n for a new line.
Choose single quotes, which is what SQL string values use.
Yes, each item is trimmed.
No. It is processed in your browser.
It builds separated lists with optional quotes. For a JSON array, choose double quotes and a comma separator, then add square brackets yourself. Escape any quotes inside values manually.
No. Items keep their original order. When duplicates are removed, the first occurrence is kept and later repeats are dropped.