Beautify SQL queries with clean indentation and uppercase keywords.
🔒 100% client-side — a generic ANSI SQL formatter. Keywords are capitalized; indentation follows clause hierarchy.
A wall of minified SQL — copied from a log, a query plan, or a colleague's Slack message — is nearly impossible to read. This formatter re-indents the query so each clause sits on its own line, subqueries and parenthesised groups are indented, and keywords are capitalised. Paste messy SQL, get readable SQL, instantly.
The formatter tokenises the query (respecting string literals so 'WHERE' inside a string is not mistaken for a keyword), then re-emits it clause by clause. Top-level keywords like SELECT, FROM, WHERE, GROUP BY,ORDER BY, LIMIT, JOIN, and ON each start a new line; columns after SELECT and conditions after WHERE wrap onto a new line after each comma. The result is the canonical "vertical SQL" layout that most teams use in code reviews.
Format expands the query for human reading. Minify does the reverse: it collapses whitespace and newlines into a single line, which is useful when you need to embed a query in a JSON payload, a URL parameter, or a log line where newlines would break the surrounding format. Toggle between the two as needed — both preserve string literals exactly.
The formatter targets generic ANSI SQL, so it works across MySQL, PostgreSQL, SQLite, SQL Server, and Oracle for everyday queries. It does not deeply understand dialect-specific procedural extensions (PL/pgSQL blocks, T-SQL variables, Oracle PL/SQL), so deeply nested procedural code may not indent perfectly. It is a formatter, not a validator — it will happily re-indent a query that has a syntax error, because it does not run the query or check grammar. For validation, run the formatted output against your actual database.
More tools you might find useful
Estimate byte size of your text in various formats.
Convert text characters to binary representation.
Cargo/pyproject-style TOML parsed to clean JSON locally.
Play sine, square, triangle, and sawtooth tones from 20 Hz to 20 kHz.