Use the free List to SQL Values Converter below: your data never leaves your browser — all work happens on your device, and nothing is uploaded to any server.
The Small Job That Eats Your Afternoon
You have a list of names, codes, or cities. You need them inside an SQL IN clause. Doing it by hand means adding a quote before each item, a quote after it, doubling any quote inside it, and joining everything with commas inside parentheses. For ten items that is tedious. For two hundred items copied from a spreadsheet, it is a reliable way to waste an afternoon and still ship a typo. This converter does the whole job in one click, and it does it the same careful way every time.
The most common use is filtering. You get a list of customer IDs from a report, or a list of product codes from a colleague, and you want every matching row: SELECT * FROM orders WHERE product_code IN (…). The tool takes your pasted lines and returns exactly the parenthesised list that fits inside those brackets. It trims stray spaces, skips blank lines, and escapes single quotes by doubling them, so a name like O’Brien lands as ‘O”Brien’ instead of breaking your query.
How to Use It
Paste one value per line. That is the only rule that matters. Values copied from a spreadsheet column paste cleanly, one per line, and values typed by hand work the same way. Choose the output style you need. The IN list style gives you (‘a’, ‘b’) for WHERE clauses. The VALUES rows style gives you (‘a’), (‘b’) for building a small temporary table or a VALUES clause. The plain quoted list gives you ‘a’, ‘b’ without parentheses, for the moments when the surrounding query already supplies them.
Two optional switches cover the usual clean-up. Remove duplicates drops repeated values, which matters when your source list came from a report that repeats the same code many times. Sort A-Z orders the list, which makes long lists easier to scan and compare. Neither switch changes your data: sorting only reorders, and dedup only removes exact repeats after trimming. Check the output count against your input count if the numbers matter, because a dedup run will legitimately shrink the list.
Quoting Rules Worth Knowing
SQL text values use single quotes, and a single quote inside a value is written twice. That rule is the whole escaping story for this tool, and it is easy to get wrong by hand. Double quotes do not escape text in standard SQL, and backslashes do not either, so the tool never uses them. If your values are numbers rather than text, you may not need quotes at all, but quoted numbers still work in most databases when compared against a numeric column, and the tool quotes everything by design so text lists are always safe.
Watch out for values that look simple but are not. A value with a leading or trailing space is a different value from the trimmed version, and the tool trims each line, so ” Madrid” and “Madrid” become the same item. That is usually what you want, but if your data genuinely distinguishes spaces, handle those rows separately. Values containing commas are fine here, because the input is one per line, not comma-separated: a city like “Springfield, Illinois” stays one value, quoted as a whole.
Where It Fits in Real Work
Beyond WHERE … IN, this tool helps with data clean-up. You can generate the value list for a CASE expression, a quick lookup table, or a test script that seeds rows. Analysts use it to turn a column copied from a report into a filter. Developers use it to turn a bug report’s list of failing IDs into a query they can run immediately. Support staff use it to check a batch of order numbers without asking a developer to write a script. In each case the win is the same: no hand-quoting, no missed comma, no broken query at the last item.
There are limits, and they are honest ones. Very long lists can hit query length limits in some databases, and a list of thousands of values is often better handled as a temporary table loaded from a file. The tool also treats every line as text, so if you need unquoted numbers, strip the quotes in your editor or generate the list with a script. For the everyday case, though, a few dozen to a few hundred text values, this is exactly the right size of tool.
Privacy and Practical Tips
Everything happens in your browser. Your list is never uploaded, stored, or logged, which matters when the values are customer names, order numbers, or internal codes. Paste, convert, copy, and close the tab. One practical tip: if your list came from a spreadsheet and pastes as one long line instead of many lines, check whether the source used tabs or commas as separators, then split it into lines first. Another: keep the original list somewhere safe until the query has run, so a typo in the query is a re-paste, not a reconstruction.
Related tools
- Convertidor de Lista a Valores SQL (Spanish version)
- CSV to ASCII Table Converter
- CSV to LaTeX Table Converter
