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.

Ad
Ad

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.

FormatExampleTypical Source
Comma-separatedapple, banana, cherryCSV files, spreadsheet exports, form fields
Newline-separatedapple\nbanana\ncherryText files, log output, terminal results
JSON array["apple", "banana", "cherry"]API responses, config files, JavaScript code
Numbered list1. apple\n2. banana\n3. cherryDocuments, task lists, instructions
Bulleted list- apple\n- banana\n- cherryMarkdown files, meeting notes
SQL IN clause('apple', 'banana', 'cherry')Database queries, data filtering
Pipe-separatedapple|banana|cherryUnix commands, log formats, data feeds
Tab-separatedapple\tbanana\tcherrySpreadsheet 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.

PriorityDetection RuleFormat Identified
1Starts with [ and ends with ] - valid JSONJSON array
2Starts with ( and contains quoted itemsSQL IN clause
3Lines start with "1.", "2.", etc.Numbered list
4Lines start with "- " or "* "Bulleted list
5Contains tab characters between itemsTab-separated
6Contains pipe characters between itemsPipe-separated
7Contains commasComma-separated
8Contains newlinesNewline-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:

ScenarioFromToWhy
Build a SQL query from a spreadsheet columnNewline (copy from Excel)SQL IN clauseQuickly filter records matching a list of IDs or names
Turn an API response into a readable listJSON arrayBulleted listPaste into documentation, Slack, or email
Prepare data for a CSV importNewline or bulletedComma-separatedMany tools expect CSV input for bulk operations
Format a numbered list for a documentComma-separatedNumbered listAdd structure to a flat list of items
Create a Markdown checklistComma or newlineBulleted listPaste into README or issue template
Build a Unix pipeline argumentNewlinePipe-separatedSome CLI tools accept pipe-delimited input
Convert TSV clipboard dataTab-separatedComma-separatedSpreadsheet 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:

InputOutput
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

OptionWhat It DoesExample
Remove duplicatesKeeps only unique items, preserving first occurrence order"a, b, a, c" becomes "a, b, c"
Sort A-ZAlphabetical sort with natural number ordering (item2 before item10)"cherry, apple, banana" becomes "apple, banana, cherry"
Trim whitespaceRemoves 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:

DestinationBest FormatReason
SQL WHERE clauseSQL IN clauseQuotes and escapes values, ready for direct use
JavaScript or Python codeJSON arrayValid syntax that can be pasted directly into source code
Spreadsheet importComma or tab-separatedMost spreadsheet applications accept both CSV and TSV
Markdown documentBulleted listStandard Markdown list syntax with dashes
Email or Slack messageNumbered or bulleted listReadable and structured for human consumption
Configuration fileNewline-separatedOne value per line is the simplest config format
Shell script variableComma or pipe-separatedEasy to split with IFS or cut in bash
Log analysis pipelinePipe-separatedAvoids 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:

DelimiterCharacterAppears in Normal Text?Human-Readable?Has Formal Standard?
Comma,Very oftenYesYes (RFC 4180)
Tab\tRarelyDepends on viewerYes (IANA registration)
Pipe|RarelyYesNo
Newline\nN/A (structural)YesNo
JSON[ , ]Enclosed formatYesYes (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.

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>