SQL Formatter
Format and beautify SQL for your dialect of choice, entirely in your browser.
Formatted
SELECT
id,
name,
email
FROM
users u
JOIN orders o ON o.user_id = u.id
WHERE
u.active = TRUE
AND o.total > 100
ORDER BY
o.created_at DESC
LIMIT
10;Formatting adjusts whitespace, indentation and keyword case only — it never changes the meaning of your query. Nothing is uploaded.
About the SQL Formatter
Paste a cramped, one-line or inconsistently indented SQL query and get back a clean, aligned statement that is actually readable. Well-formatted SQL is far easier to review, debug and share, and this formatter understands the syntax of a dozen popular dialects so it lays out clauses, joins and sub-queries correctly rather than just re-wrapping text.
You choose the dialect — Postgres, MySQL, SQL Server, SQLite, BigQuery and more — along with keyword casing, indent width and whether to use tabs. The query is reformatted as you type, entirely in your browser, so even confidential queries that reference internal schemas stay private.
How to use it
- Paste your SQL statement.
- Select the dialect that matches your database.
- Choose keyword case (upper, lower or preserve) and the indentation you prefer.
- Copy the formatted query.
Good to know
- Eleven SQL dialects, so keywords and syntax are handled correctly.
- Configurable keyword case, indent width and tabs.
- Reformats live as you edit.
- Runs in your browser; queries are never uploaded.
Frequently asked questions
Which SQL dialects are supported?
A curated set of the most-used dialects including PostgreSQL, MySQL, MariaDB, SQL Server (T-SQL), SQLite, BigQuery and standard SQL. Picking the right one ensures dialect-specific keywords and syntax are formatted correctly.
Does formatting change what my query does?
No. Formatting only changes whitespace, line breaks and keyword capitalisation. The logic of the statement is untouched, so it returns exactly the same results.
Should keywords be uppercase?
It is a style choice. Uppercase keywords (SELECT, FROM, WHERE) are a long-standing convention that makes them stand out from table and column names, but you can also lowercase them or preserve whatever you typed.
Is my query kept private?
Yes. Formatting happens locally in your browser, so a query that references internal tables or data never leaves your machine.