List to Array or SQL IN Clause
Paste a column of values and get a SQL IN (...) list, a JSON, PHP or Python array, a Bash array, a YAML list or a CSV row, quoted correctly.
Free · No sign-up · Your inputs stay in your browser
Input
Turn a list into an array or SQL IN clause
Output
Result
39 characters
For an IN clause built from user input, bind the values instead: whereIn() in Laravel, or one ? placeholder per item.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
A one-off query, not application code
Pasting IDs from a spreadsheet into WHERE id IN (...) is a daily job when investigating data. In application code, bind the values instead, so nothing typed by a user ever becomes SQL: Laravel's whereIn('id', $ids) adds one placeholder per value.
Long lists
MySQL accepts very long IN lists, limited by max_allowed_packet, and turns a list of constants into a sorted lookup. PostgreSQL handles them too, but for thousands of values = ANY($1) with an array parameter, or a join against a temporary table, keeps the statement small and the plan cacheable.