Text to array converter
Turn a pasted list into an array literal in JavaScript, Python, PHP, JSON, SQL and more.
Text to array converter
Paste a list — one item per line, or separated by commas, semicolons, spaces or tabs — and this tool turns it into a ready-to-paste array literal in the language you need. Choose JavaScript, Python, PHP or a plain JSON array, an SQL IN() clause, a comma-separated CSV row, a quoted list, or your own output delimiter. Each format follows its own rules: JSON always uses double quotes and full escaping, since that is what the spec requires, and SQL escapes an embedded quote by doubling it, the one rule that works across database engines.
Options cover what makes the output usable as-is. Numbers can stay unquoted so "42" and "3.14" come out as numbers, not strings. Set the variable name for the JavaScript, Python or PHP declaration, pick single or double quotes, and choose pretty multi-line formatting or one compact line — with a trailing comma where your style guide wants one (skipped for JSON and SQL, where it is invalid). Trim whitespace, drop empty lines, remove duplicates (optionally ignoring letter case), sort alphabetically, and switch every item to lowercase or uppercase before the array is built. Name a column and the SQL format emits a finished IN or NOT IN predicate, batched for Oracle's 1000-item limit.
This is the step between "I have a list" and "I have code": a column of product IDs going into a WHERE ... IN (...) clause, a config value becoming a JavaScript array, a spreadsheet export turning into a Python list, or a JSON array for an API request body. The tally under the output shows how many items came in and how many made it out, so a drop after enabling deduplication is easy to spot.
Everything runs locally in your browser — the list you paste never leaves your device, which matters for customer IDs, internal keys or anything else not meant for a server. Copy the result, download it as a .txt file, or send it straight into another tool.