SQL IN Clause Generator

Paste a list of values — one per line, comma-separated, or a column copied from Excel — and get a properly quoted, escaped, deduplicated IN (...) list for SQL Server, PostgreSQL, MySQL, Oracle, or SQLite. Everything runs in your browser; nothing is uploaded.

Generated IN clause

How to convert a list into a SQL IN clause

Paste values one per line, comma-separated, or straight from a spreadsheet column — the generator auto-detects the separator, including tab-separated cells copied from Excel or from a results grid. Whitespace is trimmed, blank entries are skipped, duplicates are removed (with a count of what was dropped), and single quotes inside values are escaped by doubling (O'Brien becomes 'O''Brien'). If every value looks numeric the list is left unquoted; you can force string or numeric mode with the Values are selector.

Give it a column name and it emits the full predicate — customer_id IN (…) or NOT IN (…) — ready to paste into your WHERE clause.

Engine-specific behavior

  • Oracle — a single expression list is capped at 1,000 items (ORA-01795; Oracle Database 23ai raises it to 65,535). With Oracle selected and a column name provided, lists longer than 1,000 are automatically split into col IN (…) OR col IN (…) chunks.
  • SQL Server — enable the N'...' option for nvarchar columns with non-ASCII values. Watch the reverse trap: comparing N'…' literals against a varchar column forces an implicit conversion that can turn an index seek into a scan.
  • PostgreSQL / MySQL / SQLite — no fixed item cap, but statement size and planning time grow with the list. SQLite's default maximum statement length is 1 MB.
This tool is for ad-hoc analysis and one-off queries. In application code, use parameterized queries (or a table-valued parameter / temp table for large lists) instead of string-building SQL.

Frequently asked questions

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

Paste your values into the generator above — one per line, or separated by commas or tabs (a column copied from Excel or query results works as-is). The tool trims whitespace, removes duplicates, escapes single quotes by doubling them, and wraps each value in quotes unless every value is numeric. Copy the result straight into your WHERE clause.

How many values can a SQL IN clause contain?

Oracle caps a single expression list at 1,000 items (error ORA-01795) — raised to 65,535 in Oracle Database 23ai. SQL Server, PostgreSQL, and MySQL have no fixed cap, but parsing and planning slow down noticeably in the tens of thousands of values. SQLite limits the overall statement size (1 MB by default). Past a few thousand values, load the list into a temp table and JOIN against it instead.

How does the generator handle Oracle's 1,000-item limit?

When you select Oracle as the target engine, provide a column name, and paste more than 1,000 values, the generator automatically splits the list into chunks of 1,000 and joins them as column IN (…) OR column IN (…) — the standard workaround for ORA-01795.

Do I need to escape quotes inside the values?

In SQL string literals a single quote is escaped by doubling it: O'Brien becomes 'O''Brien'. The generator applies this escaping automatically to every quoted value, so pasted names, codes, and free text are safe to use.

When should I use N'...' literals in SQL Server?

Use the N prefix when the column is nvarchar/nchar and the values contain non-ASCII characters. Be careful with the reverse case: comparing N'…' literals against a varchar column forces an implicit conversion that can turn an index seek into a scan. The generator only adds the N prefix when you explicitly enable the option.

Is a long IN list slower than a JOIN?

For small lists (up to a few hundred values) engines treat IN lists efficiently — SQL Server and PostgreSQL expand them into the same plans an equivalent OR chain would get. For large lists a temp table or table-valued parameter joined to the target table almost always plans better, and in application code a parameterized query should be preferred over string-built IN lists anyway.

Pasting IN lists into a query editor all day?

Jam SQL Studio is a free desktop SQL client for SQL Server, PostgreSQL, MySQL, Oracle, and SQLite — with IntelliSense, one-click filters, and an editor that understands your schema.

Free for personal use • No account required • Mac, Windows, Linux

More free SQL tools