What is a SQL IN clause?
The IN operator filters rows where a column matches any value in a list, such as WHERE order_id IN ('A-1001', 'A-1002'). It's shorter and clearer than chaining many OR conditions.
Analysts, support engineers and developers often receive a list of IDs in a spreadsheet, a ticket or a chat message and need to look them up. Typing quotes and commas around hundreds of values by hand is slow and invites mistakes. This generator formats the list instantly, removes duplicates, escapes apostrophes and works out whether the values need quotes.
How to use the SQL IN Clause Generator
1.Paste the values
One per line, comma separated or straight from a spreadsheet column.
2.Set the options
Add a column name, choose text or number values, and drop duplicates.
3.Copy into your query
Use NOT IN to exclude the values instead.
Example: order IDs from a spreadsheet
Five lines: A-1001, A-1002, A-1003, A-1002 again and B-2001, with the column set to order_id:
- Values
- 4 after removing the repeat
- Type
- Text, so each is quoted
- Output
- WHERE order_id IN ('A-1001', 'A-1002', 'A-1003', 'B-2001')
- Numbers 1, 2, 3
- IN (1, 2, 3)
The duplicate is dropped and the clause is ready to paste after SELECT … FROM orders.
Quoting decided for you
When every value is a number the list is left unquoted, so an index on a numeric column can be used. Otherwise each value is wrapped in single quotes with any apostrophe doubled. Quotes already around pasted values are removed first so they aren't doubled up.
Very long IN lists can be slow, and some databases have limits: Oracle allows 1,000 items in one list. For thousands of values, load them into a temporary table and join instead.
Frequently asked questions
Can I paste a column from Excel?
Yes. Copy the cells and paste; each line becomes one value.
Why are my numbers quoted?
At least one value isn't a plain number, such as A-1001. Choose Numbers to force no quotes, or fix that value.
How many values can an IN list have?
Oracle allows 1,000 per list; others allow more but slow down with very long lists.
Does NOT IN work with NULL?
Be careful: if the subquery or list contains NULL, NOT IN returns no rows. Filter NULLs out first.
Related tools
CSV & JSON to SQL INSERT Generator
Turn CSV or JSON rows into SQL INSERT statements.
SQL Formatter & Beautifier
Beautify or minify SQL for MySQL, PostgreSQL, SQL Server and more.
Remove Duplicate Lines
Delete repeated lines from a list and keep the first of each.
JSON Formatter & Validator
Pretty-print, minify, sort and validate JSON with line-numbered errors.
JSON ↔ CSV Converter
Convert JSON arrays to CSV and CSV back to JSON.
JSON to TypeScript Interface Generator
Generate TypeScript interfaces or types from a JSON sample.
More Developer tools
JSON & data
CSV tools
Network & system
Web & API
Git & releases
Encoding & security
- Base64 encode & decode
- URL encode & decode
- JWT decoder
- Hash generator
- HTML entity encoder
- Text to binary
- Morse code translator
- Caesar cipher & ROT13
- Random string generator
- Secret key generator
- 2FA code generator (TOTP)
- Encrypt & decrypt text
- Encrypt & decrypt files
- SSH key generator
- Base32 encoder and decoder
- Unicode escape converter
- Nano ID generator
- JWT generator
Text & code
- Regex tester
- Text diff checker
- Cron expression explainer
- Lorem ipsum generator
- Markdown previewer
- Slug generator
- Strip HTML tags
- Unicode character inspector
- URL parser
- Markdown TOC generator
- cURL converter
- Whitespace visualizer
- Markdown link extractor
- Regex escape
- Regex match extractor
- Split text by regex
- HTML, CSS and JS playground
- Mock data generator
- Keyboard event tester
- ASCII table