String to Array Converter
Split any delimited string into a JSON or JavaScript array with trim, dedupe, and formatting options. Free, browser-based, and built for everyday development tasks.
Quick Answer
The String to Array Converter splits delimited text into an array — by comma, newline, space, tab, semicolon, or a custom delimiter — with trim, empty-removal, and dedupe options, output as JSON, a JS literal, lines, or quoted CSV.
About String to Array Converter
Turning a blob of delimited text into a clean array is a constant micro-task: a comma-separated ID list from a spreadsheet that needs to become a JSON array for an API call, a column of values that should be a JavaScript literal, tags typed with inconsistent spacing that need deduplicating. This converter handles the split, cleanup, and output formatting in one pass, showing the item count so you can sanity-check the result before copying.
Why use this tool?
- API payloads — convert spreadsheet columns or CSV fragments into JSON arrays for request bodies
- Code literals — produce ready-to-paste JavaScript array syntax from any delimited list
- SQL IN clauses — output quoted CSV for WHERE id IN (...) queries
- List cleanup — trim whitespace, drop blanks, and deduplicate in a single conversion
- Format switching — go from one-per-line to comma-separated (or back) without a regex
How it works
- 1Paste your delimited text into the input
- 2Choose the delimiter to split on — or "Custom" for anything else (like | or ::)
- 3Toggle trim, remove-empty, and dedupe options to clean the items
- 4Pick the output format and click Convert — the item count and formatted array appear instantly
Common mistakes to avoid
- Values containing the delimiter — splitting "Smith, John" on commas produces two items; if your values can contain commas, use a different delimiter or a real CSV parser
- Forgetting to trim — " b" and "b" are different strings; without trimming, dedupe and downstream comparisons silently miss matches
- Quote style mismatch — JSON requires double quotes while most JS style guides prefer single; pick the output format matching the destination instead of find-replacing quotes afterwards
- Windows line endings — pasted text may contain \r\n; this tool splits on both, but hand-rolled split("\n") code leaves trailing \r characters on every item
Pro tip
The quoted-CSV output drops straight into SQL: WHERE email IN (<paste>). For the reverse direction — array back to plain text — convert with "One per line" and you have spreadsheet-ready data.
Frequently Asked Questions
What is the String to Array Converter?
How do I use the String to Array Converter?
Is my data private?
What do the trim, empty, and duplicate options do?
Which output format should I pick?
Related Workflows
Related Tools
String to JSON Converter
Convert JS object literals, URL query strings, or key-value lines into strict, formatted JSON. Free, browser-based, and built for everyday development tasks.
JSON Stringify
Escape JSON or plain text into a JSON string literal safe to embed in code. Free, browser-based, and built for everyday development tasks.
Text Line Sorter
Sort lines of text alphabetically, numerically, by length, or reverse. Free online text tool — fast, private, and browser-based.
Duplicate Line Remover
Remove duplicate lines from text, keep unique lines, and sort or count them. Free online text tool — fast, private, and browser-based.
Compare
Tool Trust & Transparency
Ecosystem Trust CenterProcessed in
Your browser
Input never sent to any server
Input stored
No
No logs, no accounts required
Common use cases
- Format, validate, or transform code and data without leaving your browser
- Debug encoding, decoding, or conversion issues quickly
- Generate test data or convert between formats in development workflows
Limitations
- Operates entirely in your browser — large inputs may slow older devices
- Output is a best-effort conversion; always validate critical results independently
Last verified: 2026 · Free, no account required · Validate critical output independently
Report an issue →