SQL IN Clause Generator

Turn a list of values into a ready-to-paste SQL IN clause with quotes escaped for your dialect.

Paste some values above to build the clause.

Column, dialect and list options id ยท Auto detect ยท Standard SQL

Split long lists. Oracle errors above 1000 (ORA-01795).

Options
No uploads. Your files stay on your device.

Free forever, no sign-up, no cookies. Buy me a coffee

How it works

Paste your values one per line and the IN (โ€ฆ) clause is built as you type โ€” no button to press. Text values are quoted with single quotes and any quote inside a value is escaped by doubling it (O'Brien becomes 'O''Brien'), which is the SQL-92 / ISO 9075 standard escape and works in PostgreSQL, Oracle, SQL Server and SQLite. Pick MySQL / MariaDB and backslashes are escaped too, because MySQL treats \ as an escape character unless NO_BACKSLASH_ESCAPES is set; pick SQL Server and literals get the N'' prefix so non-ASCII characters survive an NVARCHAR comparison. In Auto detect each value is judged on its own: numbers stay unquoted, a bare NULL becomes the keyword, everything else is quoted. Force it with Text, Numbers or Raw SQL when you know better.

Two details that bite people. First, NULL inside an IN list never matches anything, and a NOT IN list containing NULL returns no rows at all โ€” the tool warns you when it emits one. Second, Oracle raises ORA-01795 above 1000 expressions in a single IN list, so set Max values per clause to split the list into several clauses: IN chunks are joined with OR, NOT IN chunks with AND, and the whole thing is wrapped in parentheses so it drops straight into a WHERE. Everything runs in your browser with JavaScript, so customer IDs, e-mail addresses and other production data never leave your device. Escaping quotes is a formatting convenience, not a security control โ€” for values that come from users, use bound parameters instead of pasting a generated clause.

Frequently asked questions

How do I turn a list of values into a SQL IN clause?

Paste your values into the top box with one per line and the clause appears instantly below, no button to press. Type the column name in the Column name field and the output becomes something like id IN (101, 102, 103), ready to paste after your WHERE. Spaces are trimmed and blank lines dropped by default, and you can remove duplicates or sort the values before the clause is built. Then hit Copy clause or Download .sql.

Are quotes and apostrophes escaped correctly?

Yes. Text values are wrapped in single quotes and any quote inside a value is doubled, which is the SQL-92 (ISO 9075) escape, so O'Brien becomes 'O''Brien' and works in PostgreSQL, Oracle, SQL Server and SQLite. Choose MySQL / MariaDB and backslashes are doubled too, because MySQL treats a backslash as an escape character unless NO_BACKSLASH_ESCAPES is set. Choose SQL Server and literals get the N'' prefix for nvarchar comparisons. Escaping is a formatting convenience, not a security control: for values that come from users, use bound parameters instead of a generated clause.

What if my list is longer than Oracle's 1000-value IN limit?

Set Max values per clause to 1000 and the list is split into several clauses. IN chunks are joined with OR, NOT IN chunks with AND (they all have to hold), and the whole thing is wrapped in parentheses so it drops straight into a WHERE. That sidesteps ORA-01795, which Oracle raises above 1000 expressions in a single IN list. Splitting needs a column name, since every chunk has to name its own column.

Report a bug