Convert a list to a SQL IN clause

Convert a list to a SQL IN clause in one step: paste one value per line and get a quoted, comma-separated IN (...) tuple ready to drop into a WHERE. Single quotes inside a value are doubled so the string stays valid.

Input
Ready
Output
Live

Build a WHERE ... IN (...) filter from a plain list

Convert a list to a SQL IN clause whenever you have a column of IDs, usernames, or SKUs and need to query for all of them at once. Each line becomes one element of the tuple, joined with a comma and a space, wrapped in a single set of parentheses.

Values are single-quoted by default and any single quote inside a value is doubled (O'Brien becomes 'O''Brien'), which is how SQL escapes a literal quote. Switch Quotes to None when the column is numeric so you get IN (101, 102) with no quoting, or to Double quotes for engines that expect them.

Everything runs locally in your browser, so a list of customer IDs never leaves the tab. To go the other way and turn a query result back into a list, use Convert CSV to List. To wrap items in quotes without the IN clause, see Add Quotes.

How to use convert a list to a sql in clause

  1. 1Paste one value per line into the input panel.
  2. 2Pick a Quotes style: single (default), double, or none for numeric columns.
  3. 3Leave Prefix IN on to get a full IN (...) clause, or turn it off for just the parenthesised tuple.
  4. 4Turn on Dedupe to collapse repeated values before the clause is built.
  5. 5Copy the result straight into your query, or hit Download to save it as a .sql file.

Keyboard shortcuts

Drive ListShift without touching the mouse.

Shortcut Action
Ctrl ZUndo last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor
EscExit fullscreen
Ctrl KOpen the command palette to jump to any tool
Ctrl SSave current pipeline draft Plus
Ctrl PRun a saved pipeline Plus

What the SQL IN clause builder does

Five concrete behaviours to know before you paste it into production.

Single quotes are doubled, not backslash-escaped

SQL escapes a literal quote by doubling it, so O'Brien becomes 'O''Brien'. The tool never emits a backslash escape, which most SQL dialects do not accept inside a standard string literal.

Blank lines and surrounding whitespace are dropped

Each line is trimmed and empty lines are skipped, so a trailing newline or an indented paste does not produce an empty '' element in the middle of your tuple.

None mode leaves values unquoted for numeric columns

Set Quotes to None and a list of IDs becomes IN (101, 102, 103). Use this only for genuinely numeric columns; unquoted text is not valid SQL.

Prefix IN is a single toggle

On, you get the full IN (...) clause to paste after a column name. Off, you get just the (...) tuple, handy when you are assembling the query in code and already wrote the IN keyword.

Dedupe collapses repeats before quoting

Turn on Dedupe and a list with the same value twice yields it once in the clause. Order of first appearance is preserved; it does not sort the values.

Worked example

Four names, single-quoted, with the quote inside O'Brien doubled so the literal stays valid.

Input
alice
bob
carol
O'Brien
Output
IN ('alice', 'bob', 'carol', 'O''Brien')

Settings reference

How each option changes the output, using the sample list above as the input.

Setting What it does Effect on the sample
Quotes: Single (default) Wraps each value in single quotes, doubling any single quote inside Gives 'alice', ..., 'O''Brien'
Quotes: Double Wraps each value in double quotes instead Gives "alice", "bob", ...
Quotes: None Leaves values unquoted (numeric columns only) Gives (alice, bob, ...) with no quotes
Prefix IN: on (default) Prepends the IN keyword to the tuple Output starts with IN (
Prefix IN: off Emits only the parenthesised tuple Output is ('alice', 'bob', ...)
Dedupe: on Collapses repeated values, keeping first-seen order A value pasted twice appears once
Blank lines (automatic) Trimmed and skipped No empty element in the tuple

FAQ

How are quotes inside a value handled?
A single quote inside a value is doubled, so O'Brien becomes 'O''Brien'. That is the standard SQL way to put a literal quote in a string; the tool never uses a backslash escape.
Can I get an unquoted list for a numeric column?
Yes. Set Quotes to None and the output is IN (101, 102, 103) with no quotes. Only use this for numeric columns, since unquoted text is not valid SQL.
How do I get just the parentheses without the IN keyword?
Turn off Prefix IN. You then get the ('a', 'b') tuple on its own, which is useful when your code already writes the IN keyword before the values.
Does it remove duplicate values?
Only if you turn on Dedupe. By default every line becomes an element, so repeats are kept. Dedupe collapses them while preserving the order they first appeared.
Is my list uploaded anywhere?
No. The clause is built locally in your browser with JavaScript. Nothing is sent to a server, so a list of internal IDs stays on your machine.