SQL formatter
Format and beautify SQL queries with proper indentation and keyword casing, for MySQL, PostgreSQL, SQL Server and more.
How to use
Paste a SQL query and it's formatted instantly with clean indentation and aligned clauses, so a dense one-liner becomes easy to read and review. Pick your database dialect — MySQL, PostgreSQL, SQL Server, SQLite, BigQuery and more — so keywords and syntax are handled correctly.
Toggle uppercase keywords to follow the common convention of capitalising SELECT, FROM, WHERE and so on, then copy the result with one click. It's ideal for tidying queries before committing them, sharing them in a pull request, or just understanding someone else's SQL.
Formatting happens entirely in your browser, so your queries — which often contain schema or business logic — never leave your device.
Examples
Turn a long single-line SELECT with joins into a readable, indented query.
Apply consistent indentation and uppercase keywords across everyone's SQL.
Format a query in a pull request so reviewers can actually read it.
Frequently asked questions
Which SQL dialects are supported?
Standard SQL plus MySQL, PostgreSQL, SQLite, MariaDB, SQL Server (T-SQL), BigQuery and Snowflake, so dialect-specific syntax formats correctly.
Does it change what my query does?
No. It only reformats whitespace, indentation and keyword casing — the query logic is untouched.
Is my SQL sent to a server?
No. Formatting runs in your browser, so your queries stay private and it works offline.
Can it uppercase keywords?
Yes. Toggle uppercase keywords to capitalise SELECT, FROM, WHERE and the rest, or leave casing as you wrote it.
Related tools
Format, validate and minify JSON with precise error locations and key sorting.
Beautify JavaScript, TypeScript, JSON, CSS, HTML, Markdown, YAML and GraphQL with Prettier.
Minify CSS, JavaScript and HTML to shrink file size — strips comments and whitespace, with a before/after size comparison.
Convert a JSON array of objects to CSV, or CSV back to JSON — both directions, with download. Runs in your browser.
Convert between JSON and YAML in either direction, instantly.