Free online SQL formatter and beautifier with live formatting, multiple dialects, and keyword casing — all in your browser.
Compact mode collapses the formatted query onto a single line with tighter operator spacing — a denser layout, not a true minifier.
Formats automatically as you type; there’s no button to press.
This tool formats SQL queries as you type, using the open-source sql-formatter library running entirely in your browser. Pick the SQL dialect that matches your database, choose how keywords are cased, and adjust indentation to match your team's style — all without sending a single query to a server.
Is my SQL query sent to a server?
No. Formatting runs entirely in your browser using the sql-formatter JavaScript library — your queries, including table and column names, never leave your device.
What does the compact mode do?
Compact mode collapses the formatted query onto a single line and tightens spacing around operators. It's not a true minifier — SQL doesn't have a smaller binary form the way JSON does — it's simply a denser layout of the same formatted tokens.
Why does formatting fail with an error?
The formatter needs syntactically valid SQL for the dialect you've selected. Unbalanced parentheses, unterminated strings, or dialect-specific syntax that doesn't match your selection will produce a parse error with the line and column where it occurred.
Which SQL dialect should I pick?
Pick the dialect that matches the database you're writing for. Dialects differ in keyword sets and syntax quirks — for example, T-SQL's TOP versus MySQL's LIMIT — so choosing the right one gives more accurate formatting and fewer false parse errors.
Does this tool run my query against a database?
No. It only parses and re-prints the text of your query — it never connects to a database or executes anything.
Does formatting change how my query executes?
No. Formatting only changes whitespace, line breaks, and keyword casing. The tokens, clauses, and logic of your query are untouched, so its execution and result set stay exactly the same.
Your SQL is formatted entirely in your browser. Nothing is uploaded, stored, or sent to any server.