75 chars · 1 line
Waiting for input
75 chars · 1 line
Waiting for input
SQL formatting guide
Turn dense SQL into an indented, readable query, choose a target dialect and keyword casing, or collapse unnecessary whitespace for compact storage. Formatting and minification run entirely in your browser, and quoted values and comments remain part of the result. This tool is free to use. No account or payment is required.
Last updated
Format mode adds line breaks and indentation around common SQL clauses, columns, conditions, joins, and ordering expressions. This helps with code review, debugging, and documenting generated queries.
Choose Generic SQL, PostgreSQL, MySQL, or SQLite parsing, and optionally normalize recognized keywords to uppercase or lowercase. Preserve case remains the default so existing formatting behavior does not change unless you choose it.
Formatting changes presentation rather than the intended query values.
Minify mode collapses whitespace outside protected regions while retaining line comments, block comments, and content inside single quotes, double quotes, backticks, square-bracket identifiers, and PostgreSQL dollar-quoted blocks.
The formatter does not connect to a database, execute the query, optimize a plan, or guarantee that every vendor-specific statement is valid. Always test production SQL against the target database and dialect.
A compact SELECT statement becomes easier to scan while the quoted status value remains unchanged.
select id,name from users where status = 'active' order by created_at desc;SELECT
id,
name
FROM
users
WHERE
status = 'active'
ORDER BY
created_at DESC;Common questions
No. The minifier removes unnecessary whitespace outside protected regions but keeps line and block comments in the output.
Format mode supports Generic SQL, PostgreSQL, MySQL, and SQLite selections. The chosen dialect guides parsing and formatting, but vendor-specific statements still need review against the database that will execute them.
No. The tool only transforms text and never connects to a database or verifies the execution plan.
No. Formatting and minification run locally in your browser.
Looking for broader references? Browse all developer guides.