Get the values back out of a WHERE ... IN (...) filter
Convert a SQL IN clause to a list whenever you have copied a filter out of a query, a log line, or a bug report and need the values as rows you can sort, dedupe, or diff. Paste the whole fragment: the tool locates the parenthesised tuple that follows the `IN` keyword and ignores everything before and after it.
The tuple is then read with a quote-aware scan rather than a plain split on commas. A comma inside `'north, south'` stays part of the value, a doubled quote inside `'O''Brien'` becomes one apostrophe, and both single and double quoted literals are accepted. Unquoted numeric values such as `IN (101, 102)` come through as-is. Only the standard doubled-quote escape is understood, so a MySQL-style backslash escape, a function call, or a subquery inside the tuple will not parse cleanly.
Everything runs locally in your browser, so a production filter full of customer IDs stays on your machine. Once you have the list, find duplicates, diff it against another list, or export it as CSV.
How to use convert a sql in clause to a list
- 1Paste the IN clause, or the whole WHERE fragment, into the input panel.
- 2Read the values in the output panel, one per line, with the quoting removed.
- 3Leave Trim on to drop the spaces that sit between the commas and the values.
- 4Turn on Dedupe to collapse a tuple that repeats the same value.
- 5Copy the list, or hit Download to save it as a plain text file.
Keyboard shortcuts
Drive ListShift without touching the mouse.
What the SQL IN clause parser does
Five concrete behaviours that decide what lands on each line.
The IN keyword locates the tuple
The first `IN (` in the input marks the start, and a quote-aware scan finds its matching close paren. Text before and after is discarded, so `AND status IN ('open','closed') AND active = 1` yields just `open` and `closed`.
A comma inside a quoted literal does not split
Values are read with a scanner that tracks quote state, not by splitting the string on commas. `IN ('north, south', 'east')` gives two values, the first of which is `north, south` with its comma intact.
Doubled quotes unescape to one character
SQL escapes a literal quote by doubling it, so `'O''Brien'` is one value and comes back as `O'Brien`. This exactly reverses what Convert List to SQL IN Clause writes.
Single quotes, double quotes, and no quotes all parse
Whichever your engine emits is accepted, and the outer quotes are always removed. An unquoted numeric tuple such as `IN (101, 102, 103)` comes through unchanged, one number per line.
A bare tuple or bare list still parses
With no `IN` keyword the first parenthesised group is used instead, and with no parentheses at all the whole input is read as the value list. Pasting `'a', 'b', 'c'` on its own works.
Worked example
The comma inside `north, south` is protected by its quotes, the doubled quote in `O''Brien` unescapes to one apostrophe, and the `AND active = 1` after the tuple is ignored.
AND region IN ('north, south', 'east', 'O''Brien') AND active = 1
north, south east O'Brien
Settings reference
How each option changes the output, using the sample clause above as the input.
| Setting | What it does | Effect on the sample |
|---|---|---|
| Trim: on (default) | Removes the whitespace around each value | Gives alice, bob, carol, O'Brien with no leading space |
| Trim: off | Keeps the spaces that followed each comma | Lines 2 to 4 start with a space |
| Dedupe: on | Collapses repeated values, keeping first-seen order | No repeats in the sample, so no change |
| IN keyword (automatic) | Marks where the tuple starts; a quote-aware scan finds its close paren | The WHERE customer_id prefix is ignored |
| Quoting (automatic) | Outer single or double quotes are removed from every value | alice, not 'alice' |
| Doubled quotes (automatic) | A doubled quote inside a literal becomes one character | O''Brien becomes O'Brien |
| Quoted commas (automatic) | A comma inside quotes stays part of the value | Not exercised by the sample; see the worked example |
| Empty cells (automatic) | A cell that is empty after trimming is dropped | No blank lines in the output |