SQL Formatter
Lays out a query with lines and indents, checks it against the source, and warns about UPDATEs without WHERE, string concatenation and passwords in the text.
The query is not sent anywhere: parsing, formatting, and validation all run in the browser. You can paste queries from logs and source code as is.
Result
Pitfalls
The query is split across lines: keywords start a line, fields and conditions move to an indent, joins and conditions after AND and OR each get their own place, and subqueries in parentheses unfold into an indented block. Several queries in a row are separated by a blank line.
The reverse button squeezes the query into a single line, which is handy when you paste it into code or a ticket.
The result is checked against the source
Formatting changes only spaces, line breaks, and the case of keywords. The query can then be parsed again and the token stream compared with the original: the two must match exactly. If anything differs, the tool says so directly instead of showing a ready-made result.
Dangerous spots in a query
Parsing works on the same token tree, so strings and comments are never taken for code. The tool flags:
- DELETE and UPDATE without a condition, including a placeholder condition like WHERE 1 = 1 that was meant to be filled in later and forgotten;
- concatenating a string with a value: this is how queries are built by substitution, and a value with a quote inside changes its meaning entirely;
- passwords, tokens, phone numbers, email addresses, and card numbers in plain query text. The values themselves are never shown, or the report would become a leak of its own;
- an unclosed quote or comment, and mismatched parentheses;
- Latin letters inside Russian names: "c", "o", "e", "a" exist in both keyboard layouts, they look identical, but the database will not find such a name;
- AND and OR in the same condition without parentheses, a row limit without sorting, and NOT IN with a subquery.
The query stays local
Queries often contain passwords, phone numbers, and addresses of real people. Parsing, formatting, and the comparison all run on your side, and nothing is sent anywhere.
Rate this tool
Help us get better
Tell us what was missing.
Other tools
JSON Formatter
Format and repair JSON in the browser, flagging duplicate keys and long numbers
Regex Tester
Regex testing with a plain-language breakdown and hang protection
JWT Decoder
JWT parsing with fields explained and signature verification
CSV to JSON
A table to JSON with honest types and a reverse check
JSON to CSV
JSON to a table for Excel, with verification and formula protection
XML Formatter
Readable XML, errors explained with a hint, verified against the source
XML Validator
Markup, XSD schema, sitemap, YML and RSS rules, with the path to each error
String Escape / Unescape
Nine modes in both directions, catches double escaping