List Converter
Convert lists between comma, newline, JSON array, CSV, pipe, numbered, bulleted, and SQL IN formats. Paste any list and pick the output.
This list converter takes items in one format and outputs them in another. Paste a comma-separated list, one-per-line list, JSON array, numbered list, bulleted list, SQL IN clause, pipe-separated, or tab-separated values. The tool auto-detects the input format, parses the items, and lets you pick any output format. All processing runs in your browser with no data sent to any server.
About List Converter
Supported Input and Output Formats
The converter handles eight distinct list formats, covering the most common delimiters used in software development, data analysis, and everyday document editing.
| Format | Example | Typical Source |
|---|---|---|
| Comma-separated | apple, banana, cherry | CSV files, spreadsheet exports, form fields |
| Newline-separated | apple\nbanana\ncherry | Text files, log output, terminal results |
| JSON array | ["apple", "banana", "cherry"] | API responses, config files, JavaScript code |
| Numbered list | 1. apple\n2. banana\n3. cherry | Documents, task lists, instructions |
| Bulleted list | - apple\n- banana\n- cherry | Markdown files, meeting notes |
| SQL IN clause | ('apple', 'banana', 'cherry') | Database queries, data filtering |
| Pipe-separated | apple|banana|cherry | Unix commands, log formats, data feeds |
| Tab-separated | apple\tbanana\tcherry | Spreadsheet copy-paste, TSV files |
How Does Auto-Detection Work?
The tool examines the input text and checks for format signatures in a specific priority order. More distinctive formats (JSON, SQL) are checked first, with the most generic patterns (commas, newlines) checked last. This ordering avoids false matches - a JSON array contains commas, but the square bracket wrapper is detected first.
| Priority | Detection Rule | Format Identified |
|---|---|---|
| 1 | Starts with [ and ends with ] - valid JSON | JSON array |
| 2 | Starts with ( and contains quoted items | SQL IN clause |
| 3 | Lines start with "1.", "2.", etc. | Numbered list |
| 4 | Lines start with "- " or "* " | Bulleted list |
| 5 | Contains tab characters between items | Tab-separated |
| 6 | Contains pipe characters between items | Pipe-separated |
| 7 | Contains commas | Comma-separated |
| 8 | Contains newlines | Newline-separated |
If multiple formats could match, the tool picks the most specific one. The detection runs instantly on every keystroke, so the item count updates as you type or paste.
Common Conversion Scenarios
The most frequent use case is converting between the format something was exported in and the format another system expects. Here are the conversions people run most often:
| Scenario | From | To | Why |
|---|---|---|---|
| Build a SQL query from a spreadsheet column | Newline (copy from Excel) | SQL IN clause | Quickly filter records matching a list of IDs or names |
| Turn an API response into a readable list | JSON array | Bulleted list | Paste into documentation, Slack, or email |
| Prepare data for a CSV import | Newline or bulleted | Comma-separated | Many tools expect CSV input for bulk operations |
| Format a numbered list for a document | Comma-separated | Numbered list | Add structure to a flat list of items |
| Create a Markdown checklist | Comma or newline | Bulleted list | Paste into README or issue template |
| Build a Unix pipeline argument | Newline | Pipe-separated | Some CLI tools accept pipe-delimited input |
| Convert TSV clipboard data | Tab-separated | Comma-separated | Spreadsheet copy-paste uses tabs, but most tools want commas |
Worked Example: Spreadsheet Column to SQL IN Clause
Say you have a column of customer IDs in a spreadsheet: 1042, 1087, 1103, 1205, 1299. You need a SQL query to pull records for just those customers.
Step 1: Copy the column from Excel or Google Sheets. The clipboard gives you a newline-separated list:
1042
1087
1103
1205
1299
Step 2: Paste into the input box. The tool auto-detects "Newline-separated" and shows "5 items detected".
Step 3: Click "SQL IN clause" as the output format. The result is:
('1042', '1087', '1103', '1205', '1299')
Step 4: Drop it into your query: SELECT * FROM customers WHERE id IN ('1042', '1087', '1103', '1205', '1299')
The entire process takes a few seconds and eliminates the manual quoting and comma insertion that makes this task tedious by hand.
SQL IN Clause Formatting
The SQL IN output wraps each value in single quotes with proper escaping, formatted for direct use in a WHERE clause:
| Input | Output |
|---|---|
| apple, banana, cherry | ('apple', 'banana', 'cherry') |
| 101, 205, 308 | ('101', '205', '308') |
| O'Brien, McDonald's | ('O''Brien', 'McDonald''s') |
Single quotes within values are escaped by doubling them, following the SQL standard defined in ISO/IEC 9075. Numeric values are quoted as strings by default - if your database column is an integer type, most engines (PostgreSQL, MySQL, SQL Server) will cast the strings automatically.
One thing to keep in mind: Oracle limits IN clauses to 1,000 expressions per list. SQL Server can handle more but performance degrades past a few hundred items. For lists over 100 items, a temporary table with a JOIN is usually faster than an IN clause. PostgreSQL and MySQL have no documented hard limit, but the same performance advice applies.
Understanding the Underlying Formats
Each delimiter format has its own specification and quirks worth knowing about.
CSV (comma-separated): Formally standardised in RFC 4180, published by the IETF in 2005. The spec registers the MIME type text/csv and defines rules for quoting fields that contain commas, line breaks, or double quotes. Despite the standard, real-world CSV files vary widely - some use semicolons as delimiters (common in European locales where commas are decimal separators), and line endings differ between operating systems. This converter handles the most common variant: comma-delimited with optional whitespace trimming.
JSON arrays: Defined in both ECMA-404 (2nd edition, December 2017) and RFC 8259 (published 2017, Internet Standard STD 90). An array is a pair of square brackets surrounding zero or more values separated by commas. JSON has become the dominant data interchange format for web APIs and configuration files. The converter parses JSON using the browser's native JSON.parse(), so it handles nested values, escaped characters, and Unicode correctly.
TSV (tab-separated): Registered with IANA as the MIME type text/tab-separated-values, originally submitted by the University of Minnesota Gopher team. Unlike CSV, the TSV specification explicitly disallows tabs and newlines within field values, which makes parsing simpler but limits what can be stored in a single field. When you copy cells from Excel or Google Sheets, the clipboard format is tab-separated, making TSV-to-comma conversion one of the most practical uses of this tool.
Pipe-separated: No formal RFC or standard exists for pipe-delimited data, but the format is common in Unix tooling. The awk default field separator is whitespace, but many log formats and data feeds use pipes because the character rarely appears in natural text. The HL7 healthcare data standard also uses pipes as segment field separators.
Cleaning Options
| Option | What It Does | Example |
|---|---|---|
| Remove duplicates | Keeps only unique items, preserving first occurrence order | "a, b, a, c" becomes "a, b, c" |
| Sort A-Z | Alphabetical sort with natural number ordering (item2 before item10) | "cherry, apple, banana" becomes "apple, banana, cherry" |
| Trim whitespace | Removes leading/trailing spaces from each item | " apple , banana " becomes "apple, banana" |
All options work together and update the output in real time. Removing duplicates is applied before sorting, so the sort operates on the deduplicated list. The natural sort uses localeCompare with numeric ordering enabled, meaning "item2" sorts before "item10" rather than after it (which is what a naive alphabetical sort would produce).
Tips for Working with Lists
Pasting from spreadsheets: When you copy a column from Excel or Google Sheets, the data lands on the clipboard as tab-separated values, one row per line. Paste it here and convert to whatever format you need. If you copy multiple columns, the tool treats each tab-separated row as a single item, which may not be what you want - copy one column at a time for clean results.
JSON arrays with mixed types: If the JSON array contains numbers and strings (like [1, "two", 3]), each value is converted to a string. Nested objects or arrays within the items are stringified rather than recursively flattened.
Numbered lists with gaps: The parser strips the leading number and period from each line, so it does not matter if the numbering is sequential. "1. Alpha, 5. Beta, 12. Gamma" parses to three items. Both "1." and "1)" notation styles are handled.
Large lists: The tool displays a preview of detected items as tags below the output for lists up to 50 items. For larger lists, the tag preview is hidden to keep the page responsive, but conversion still works.
Combining cleaning options: Trim, deduplicate, and sort can be used together. The processing order is trim first, then deduplicate, then sort. This means items that are identical after trimming (like " apple" and "apple") are correctly collapsed into one entry before sorting.
When to Use Which Format
Choosing the right output format depends on where the data is going next:
| Destination | Best Format | Reason |
|---|---|---|
| SQL WHERE clause | SQL IN clause | Quotes and escapes values, ready for direct use |
| JavaScript or Python code | JSON array | Valid syntax that can be pasted directly into source code |
| Spreadsheet import | Comma or tab-separated | Most spreadsheet applications accept both CSV and TSV |
| Markdown document | Bulleted list | Standard Markdown list syntax with dashes |
| Email or Slack message | Numbered or bulleted list | Readable and structured for human consumption |
| Configuration file | Newline-separated | One value per line is the simplest config format |
| Shell script variable | Comma or pipe-separated | Easy to split with IFS or cut in bash |
| Log analysis pipeline | Pipe-separated | Avoids conflicts with commas in data values |
If the destination is another tool on this site, comma-separated is usually the safest choice since it is the most universally accepted delimiter.
Delimiter Comparison
Each delimiter has trade-offs in terms of readability, safety, and compatibility:
| Delimiter | Character | Appears in Normal Text? | Human-Readable? | Has Formal Standard? |
|---|---|---|---|---|
| Comma | , | Very often | Yes | Yes (RFC 4180) |
| Tab | \t | Rarely | Depends on viewer | Yes (IANA registration) |
| Pipe | | | Rarely | Yes | No |
| Newline | \n | N/A (structural) | Yes | No |
| JSON | [ , ] | Enclosed format | Yes | Yes (RFC 8259, ECMA-404) |
Commas are the most common delimiter but also the most problematic because they appear frequently in natural text (addresses, numbers in some locales, sentences). Tabs and pipes are safer choices when the data might contain commas. JSON wraps everything in a structured format with its own escaping rules, making it the most robust option for programmatic use but heavier for simple lists.
To remove duplicate lines from longer text blocks (not just list items), the duplicate line remover handles full paragraphs and preserves blank lines. For cleaning up extra spaces and blank lines, the whitespace remover is purpose-built. And if you need to reformat JSON data specifically, the JSON formatter offers pretty-printing with adjustable indentation.
Sources
Frequently Asked Questions
What list formats does this tool support?
It supports comma-separated, newline-separated, JSON array, numbered list, bulleted list, SQL IN clause, pipe-separated, and tab-separated formats. It auto-detects the input format and can convert to any of the others.
Can it detect the input format automatically?
Yes. Paste any list and the tool will auto-detect whether it is comma-separated, newline-separated, JSON, numbered, bulleted, pipe-separated, or a SQL IN clause, then parse the items accordingly.
Can I remove duplicate items?
Yes. Toggle the "Remove duplicates" option and the tool will keep only unique items in the output, preserving their original order.
Does it support sorting?
Yes. Enable "Sort A-Z" to sort items alphabetically with natural number ordering (so "item2" comes before "item10").
How do I convert a comma list to a SQL IN clause?
Paste your comma-separated values, then click "SQL IN clause" as the output format. The tool wraps each item in single quotes and formats them inside parentheses, ready to drop into a SQL query.
Related Tools
Link to this tool
Copy this HTML to link to this tool from your website or blog.
<a href="https://toolboxkit.io/tools/list-converter/" title="List Converter - Free Online Tool">Try List Converter on ToolboxKit.io</a>