What a List Converter Does
A list converter takes a list of items in one shape and rewrites it in another: changing the separator, adding or removing quotes, trimming whitespace, removing duplicates, sorting, and wrapping each item with a prefix or suffix. It exists because the lists we copy from spreadsheets, logs, and emails are almost never in the format the next tool expects — and reformatting them by hand is tedious and error-prone.
The Most Common Conversions
Newlines to comma-separated. You copy a column from a spreadsheet and need a single comma-separated line:
apple apple, banana, cherry
banana →
cherry
Wrapping for a SQL IN clause. A list of IDs needs quotes and commas to drop into a query:
101 '101', '102', '103'
102 →
103
SELECT * FROM orders WHERE id IN ('101', '102', '103');
Building a code array. The same list, wrapped as a JavaScript array literal:
const ids = ['101', '102', '103'];
These are all the same operation — set a prefix, suffix, and separator — applied with different settings.
Deduplicate and Sort
Two transforms do most of the cleanup work:
- Deduplicate removes repeated items. This is invaluable for turning a raw log of values into a unique set — for example, collapsing thousands of repeated user IDs into the distinct ones.
- Sort orders items alphabetically or numerically. Combined with deduplication, a chaotic pasted list becomes a clean, ordered, unique set in one step.
Order matters: trim whitespace first, then deduplicate (so apple and apple are recognized as the same), then sort.
Quoting and Escaping
When wrapping items in quotes, watch for items that already contain the quote character or the separator. A value like O'Brien will break a single-quoted SQL list unless the quote is escaped ('O''Brien'). For CSV output, any item containing a comma must itself be quoted. Decide on the target format's escaping rules before generating, and review the output for items with special characters.
Practical Workflows
- From spreadsheet to query: paste a column, dedupe, wrap in quotes, join with commas → SQL
INlist. - From log to allowlist: paste raw lines, trim, dedupe, sort → a clean config array.
- From CSV to newlines: split on commas, strip quotes → one item per line for further editing.
- From list to JSON array: wrap each item in quotes, comma-join, surround with brackets.
Frequently Asked Questions
How do I convert a list to comma-separated values? Paste the list with one item per line and set the output separator to a comma. The converter joins them into a single line, optionally adding quotes around each item.
Can it remove duplicates from a list? Yes. Enable deduplication to keep only the first occurrence of each item. Trim whitespace first so visually identical items are matched correctly.
How do I build a SQL IN clause from a list?
Wrap each item in single quotes, join with commas, and paste the result between the parentheses of IN (...). Escape any values that contain a quote.
Use the list converter above to reshape, deduplicate, sort, and wrap lists for SQL, CSV, and code without manual editing.