SQL input
Paste or type SQL, or choose a .sql file.
Output
Formatted with the dialect and indent above — ready to copy or download.
Paste or type SQL above, or choose a file, to see the result here.
Format SQL without leaving your browser
Paste a query, type it directly, or choose a .sql file. Pick a dialect close to what you write — standard SQL, MySQL, PostgreSQL, SQLite, or MariaDB — and an indent width of 2 or 4 spaces, and the query is reformatted with consistent line breaks and indentation.
Formatting is done by sql-formatter, an open-source library. It reflows whitespace and line breaks around keywords, clauses, and joins; it does not rewrite identifiers or change keyword casing on its own. It is a lenient tokenizer, not a full parser for any one database's grammar, so it does not check whether a query is valid or would actually run — if it cannot make sense of the input at all, the error it throws is shown exactly as reported, with nothing invented in its place.
Why your SQL stays on your device
Privacy here is structural, not a promise. There is no upload step because there is no server to upload to — this matters more than usual here, since SQL pasted into a formatter is often a real query against production data, sometimes with table or column names you would rather not send anywhere:
- Formatting happens entirely in your browser, using the sql-formatter library.
- The page is served as static files and makes no request with your SQL.
- The source is open and anyone can read it (MIT).
- It works offline, which is only possible because nothing leaves the device.
If you want to check for yourself, open your browser's Network panel while formatting — no request carries your data. Read the source.
How to use it
-
Add your SQL
Paste it into the text box, type it directly, or click to choose a .sql file. Dropping a file anywhere on the page works too.
-
Pick a dialect and indent
Choose the dialect closest to what you write (standard SQL, MySQL, PostgreSQL, SQLite, or MariaDB) and an indent of 2 or 4 spaces.
-
Check the result
If the formatter cannot make sense of the query, the raw error it reported is shown so you can find and fix the issue — nothing is guessed or fabricated.
-
Copy or download the result
Copy the formatted query to the clipboard, or download it as a .sql file.
FAQ
Is my SQL uploaded anywhere?
No. Formatting happens entirely in your browser. There is no server component, so your query has no path off your device. The source is open and you can confirm this in your browser's Network panel.
Which SQL dialects are supported?
The dropdown offers standard SQL (a generic default), MySQL, PostgreSQL, SQLite, and MariaDB — a practical subset of what the underlying sql-formatter library supports. Standard SQL works reasonably well for most simple queries; pick the specific dialect when your query uses that database's particular syntax.
Does this check whether my SQL is correct, or would actually run?
No. sql-formatter is a lenient tokenizer, not a strict parser for any specific database's grammar — it reformats whitespace without fully validating syntax or semantics against a real engine. Formatting succeeding is not proof the query will run; formatting failing does not necessarily mean the query is invalid SQL for your database, only that this tool could not tokenize it.
What happens if formatting fails?
The exact error message thrown by the formatter is shown as-is. Nothing is rewritten or guessed on top of it — if the message is technical, that is because it is showing you exactly what the library reported.
Does formatting change the query itself?
Only whitespace and line breaks change. Keywords, identifiers, and literals are left as you wrote them — the tool does not rename anything, change keyword case, or alter the logic of the query.
Does it work offline?
Yes. It is a PWA. After the first visit it is cached, so formatting works without a network connection. You can also install it to your home screen.