Skip to content

Text to array converter

Turn a pasted list into an array literal in JavaScript, Python, PHP, JSON, SQL and more.

Input
Output

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.

FAQ

Which programming languages can I generate an array for?
JavaScript, Python and PHP array literals, a plain JSON array, an SQL IN() clause, a CSV row, a quoted comma-separated list, or a list joined by any custom delimiter you type in.
Why does the JSON output ignore my quote style setting?
JSON strings are required to use double quotes and fully escaped characters by the JSON specification, so that format always renders correctly regardless of the quote style you picked for the other formats.
Can numbers stay unquoted in the output?
Yes. Turn on "Leave numbers unquoted" and any item that looks like a plain number, such as 42 or 3.14, is written without quotes instead of as a string.
What happens if I ask for a trailing comma with JSON or SQL?
It is skipped for those two formats. A trailing comma is invalid JSON, and most SQL dialects reject one inside an IN() clause, so the option only takes effect for JavaScript, Python, PHP, the quoted list and custom-delimiter output.
Is my list uploaded anywhere?
No. The conversion runs entirely in your browser, so your list never leaves your device.