Output will appear here...SQL Formatter turns dense, single-line or inconsistently written SQL into readable, review-friendly queries. It puts each major clause — SELECT, FROM, WHERE, JOINs, GROUP BY, ORDER BY, HAVING, LIMIT, UNION — on its own line, breaks SELECT columns onto separate lines, indents AND/OR conditions under their clause, and normalizes keyword casing to upper or lower. The result is the kind of layout you would want in a code review: a 400-character query from an ORM log becomes a structure you can actually scan for the missing join condition.
Under the hood it is a real tokenizer, not a pile of find-and-replace rules. String literals (including doubled-quote and backslash escapes), double-quoted and backtick-quoted identifiers, bracketed SQL Server identifiers, numbers, operators and both comment styles (-- line and /* block */) are lexed as atomic tokens before any layout decision is made. That means a column value like 'SELECT * FROM users' inside a string is never mistaken for a clause, and formatting can restructure whitespace without ever corrupting literal content.
The Minify mode does the opposite: it collapses a formatted query to a single line — dropping comments, preserving every literal byte-for-byte — which is handy for log grepping, packing queries into JSON payloads or .env files, and comparing query shapes. Everything runs 100% client-side in your browser, so production queries containing table names, customer data in literals or schema details are never uploaded, logged or stored anywhere.
Drop in any query — a one-liner from an ORM debug log, a hand-written report query, or a multi-statement script separated by semicolons.
Choose UPPERCASE or lowercase for keywords and 2, 4 or 8 spaces of indentation to match your team conventions.
Format produces clause-per-line output with SELECT columns on their own lines and AND/OR conditions indented. Minify collapses everything to a single line with comments removed and literals untouched.
Copy the result to your clipboard for a code review or migration file, or download it as a .sql file.
String literals, quoted identifiers and comments are lexed first — formatting can never alter data inside quotes
SELECT, FROM, WHERE, JOIN variants, GROUP BY, ORDER BY, HAVING, LIMIT and UNION each start a new line, with subqueries indented by nesting depth
A comprehensive keyword list (DML, DDL, functions, types) is converted to UPPER or lower case; identifiers are left exactly as written
Comma-separated select lists break onto individual indented lines, making wide queries diffable in pull requests
Format, validate, and minify JSON data
Minify CSS to cut file size or beautify minified stylesheets for debugging
Minify HTML markup for faster page loads or beautify it for readable, indented source
Validate YAML syntax and convert to JSON format
0 comments
No comments yet. Be the first to share your thoughts!