Have a column of IDs from a spreadsheet, log, or query result and need them inside a WHERE id IN (...)? Paste the list and this tool assembles a clean, correctly quoted SQL IN clause ready to drop into your query.
How it works
The builder runs a small pipeline:
- Split the input on newlines, commas, semicolons, or tabs, trim each piece, and drop empties.
- De-duplicate (optional) by keeping the first occurrence of each value.
- Quote each value. In auto mode, anything matching a clean number pattern stays bare and everything else is wrapped in single quotes with
'escaped as''. You can also force always-quote or never-quote. - Assemble
column IN (...)— orNOT INif toggled — joining values inline, or one per indented line in multiline mode.
Examples
Pasting 1001, 1002, 1002, 1007 with column id, auto quoting, de-dupe on:
id IN (1001, 1002, 1007)
A list of strings like GB, US, FR becomes:
country IN ('GB', 'US', 'FR')
Long lists are easier to read and diff in multiline mode:
user_id IN (
1001,
1002,
1007,
1015
)
| Option | Effect |
|---|---|
| Auto quoting | Numbers bare, strings single-quoted |
| De-duplicate | Removes repeated values |
| NOT IN | Swaps IN for NOT IN |
| Multiline | One value per indented line |
When to use IN vs alternatives
IN is the right choice when you have a short or medium list of discrete values (up to a few hundred at most). For very large lists, consider alternatives:
Temporary table or CTE. Load your list into a temporary table and join to it. This scales to millions of rows, uses an index, and is far faster than a thousand-value IN list, which forces the database to scan or build a large set for each row comparison.
= ANY(ARRAY[...]) in PostgreSQL. Semantically the same as IN but sometimes lets the planner choose a better execution path for larger arrays.
NOT IN with NULLs. Be careful: if any value in a NOT IN list is NULL, the entire expression evaluates to UNKNOWN, and no rows are returned. Use NOT EXISTS or a LEFT JOIN ... IS NULL pattern when the exclusion list may contain nulls.
For lists you assemble from a spreadsheet export or CSV, this tool handles the most common case: turn a raw column of values into a safe, quoted IN clause in seconds without writing a script.
Everything runs in your browser — nothing is uploaded.