🗄️ SQL Formatter
Paste a SQL query to beautify it with clean indentation and keyword casing — or minify it to a single line. Runs entirely in your browser.
Frequently Asked Questions
What does the SQL beautifier do to my query?
It places major clauses — SELECT, FROM, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT, UNION, INSERT, UPDATE, DELETE — on their own lines, indents conditions after ON, AND and OR, puts each selected column on its own line after a comma, and normalises keyword casing (UPPERCASE, lowercase, or unchanged).
What does Minify mode do?
Minify collapses the entire query onto a single line with single spaces between tokens and removes comments (both -- line comments and /* block */ comments). This is useful for embedding SQL in code, log lines, or URL parameters.
Which SQL dialects are supported?
The formatter is dialect-agnostic and works with standard SQL used by MySQL, PostgreSQL, SQL Server, Oracle and SQLite. It correctly preserves single-quoted strings, double-quoted and backtick-quoted identifiers, [bracketed] SQL Server identifiers, and comments — so it never changes what your query means.
Does formatting change the result of my query?
No. Beautify only changes whitespace and keyword casing; string literals and quoted identifiers are left exactly as written, so the query executes identically. Minify additionally removes comments, which never affect execution.
Are subqueries and CASE expressions handled?
Yes — content inside parentheses (including subqueries) is indented one level deeper than the surrounding clause, and CASE / WHEN / ELSE / END expressions are broken across lines for readability.
Is my SQL uploaded to a server?
No. Formatting runs entirely in your browser with JavaScript — your query, table names and data never leave your device, so it is safe for proprietary or production SQL.