SQL Formatter
Turn a one-line query into something you can read — and review before running.
Runs in your browser — nothing you type is sent anywhere
Indentation
Dialect
Formatted
The result appears here as you type. Nothing is sent anywhere — the work happens in this page.
The dialect matters: each database has its own keywords and quoting rules, and formatting with the wrong one can misread a valid query. Your SQL is parsed in your browser and never sent anywhere — which matters, because a query often contains table names, column names and literal values from a real system.
About the SQL Formatter
A query built by an ORM, copied out of a log or written in a hurry arrives as one long line. Formatting it — clauses on their own lines, joins indented, keywords capitalised — is often the fastest way to find the bug, because the structure of a query is the thing you are actually reasoning about.
Eight dialects are supported: standard SQL, MySQL, PostgreSQL, SQLite, MariaDB, SQL Server, BigQuery and Snowflake. The dialect matters more than it looks. Each has its own keywords, its own quoting rules and its own functions, and formatting with the wrong one can misread a perfectly valid query.
Keywords can be capitalised or left as written. Capitalising is the older convention and still makes a long query easier to scan, since it separates the language from your table and column names at a glance.
The formatting is cosmetic. Nothing is reordered, no clause is rewritten and no query is optimised — the query that comes out runs exactly as the one that went in. That is the point: a formatter that changed your SQL would be unusable for the case people most need it, which is reviewing something before running it.
Your query is formatted in your browser and never sent anywhere. A real query usually names real tables and columns, and often contains literal values from a production system, so that is not a detail.
How to use the SQL Formatter
Paste your query
One statement or several. Formatting is cosmetic — nothing is rewritten or optimised.
Pick your dialect
Each database has its own keywords and quoting rules, and the wrong one can misread a valid query.
Choose capitalisation and indentation
Capitalised keywords separate the language from your table names at a glance.
Copy or download
Take it to the clipboard or save it as a .sql file.
Frequently asked questions
Does it change what my query does?
Why does the dialect matter?
Should keywords be in capitals?
Can it format several statements at once?
Is my query sent anywhere?
You may also need
JSON Formatter
Format, validate and minify JSON — with the exact line and column of any error.
JavaScript Formatter
Make minified or badly formatted JavaScript readable again.
JSON to CSV
Turn an array of JSON objects into a spreadsheet-ready CSV, nested fields included.
HTML Formatter
Indent minified or messy HTML into something readable.