How to use the list to comma separated (single quotes)
- Paste one item per line.
- Each item is wrapped in single quotes automatically: 'a','b','c'.
- Copy and paste into your query.
About this tool
SQL IN clauses need every value in single quotes and separated by commas. Paste your list, one item per line, and the output is formatted as 'a','b','c'. Copy it straight into your query. Remember to double any single quote that appears inside a value.
Building a SQL IN clause
Paste your values one per line and copy the single-quoted result into a query. Three cities become 'Pune','Delhi','Chennai', which you wrap in brackets after IN:
SELECT * FROM customers
WHERE city IN ('Pune','Delhi','Chennai');Values that contain a single quote
A name such as O'Brien ends the string early and breaks the query. In standard SQL you escape a quote by doubling it, giving 'O''Brien'. This tool does not change the text inside your items, so fix those lines first. Never build queries from untrusted input this way. Use parameters or prepared statements in application code.
Numbers do not need quotes
If the column is numeric, use the plain comma version. Quoting numbers can force the database to convert types for every row, which may be slow, and some databases reject the comparison.
Long lists
Oracle allows a maximum of 1,000 items in one IN list. Other databases accept more, but very long lists are slow and hard to read. For thousands of values, load them into a temporary table and join to it. You can also split the list into several IN clauses joined with OR.
Other uses
Single-quoted lists also suit shell scripts, where single quotes stop variables from expanding, and Python lists. Use the main list to comma separated tool when you need quotes switched off, or the double quote version for JSON.
Frequently asked questions
Do I need to escape quotes inside items?
This tool does not escape quotes inside items. If your values contain a single quote, double it ('') before using the result in SQL.
Can I switch to double quotes?
Yes. Use the Quotes dropdown or open the double quote version of this tool.
Is my list uploaded?
No. Everything runs in your browser. Your input is never sent to a server.
How do I add quotes to a list in Excel?
You can use a helper column with the formula ="'"&A1&"'" and fill down. This page does it for the whole list in one paste.
How do I handle NULL in an IN list?
NULL never matches inside IN. Add OR column IS NULL to the query if you need those rows.