SQL formatter
Pretty-print SQL in several dialects, entirely in the browser.
Runs in this tab. The file stays here.
This runs in your browser. Nothing is uploaded.
About SQL formatter
Pretty-prints SQL in your browser with the sql-formatter library and a dialect picker. Nothing is sent to a remote formatter.
Messy SQL from a log is painful to read. Paste a statement, pick a dialect, and get indented output from the sql-formatter package running locally. No pastebin, no “format online” with your production query in their access logs.
Dialects matter for quoting and some keywords. If the formatter errors, the SQL may be truncated or invalid—fix the source rather than blaming the pretty-printer first.
This does not execute queries and does not connect to a database. It is cosmetics for humans.
Edge cases include dialect-specific functions the library does not recognize, dollar-quoted strings in PostgreSQL, and pasted fragments that are not valid SQL on their own. Formatting will not fix a missing semicolon or a wrong join order. Very large pasted dumps may hitch the main thread while the formatter walks the tree.
Queries stay on this machine. Production schema snippets, customer table names, and internal column labels never hit a remote formatter service. That is the main reason to use this page instead of the first “SQL beautifier” ad result. Clear the panel when you are done on a shared screen.
How to use SQL formatter
- 1Paste SQL into the input.
- 2Choose a dialect close to your database.
- 3Copy the formatted output.
What it won't do
- Whitespace and layout only; no query planning or execution.
- Exotic dialect features may not parse cleanly.
Common questions
Does formatting run on a server?
No. sql-formatter runs in the tab.
Will this optimize my query plan?
No. It only changes whitespace and layout for reading.
Which dialects work?
Whatever sql-formatter ships—commonly SQL, PostgreSQL, MySQL, MariaDB, T-SQL, and others in the picker.
Can I format a partial WHERE clause?
Sometimes, but fragments without context often fail to parse. Wrap or paste the full statement when the formatter errors.
Related tools
Why this one doesn't upload your file
There is no server to upload to. This page is a static file, and the work happens in your browser using the same graphics and WebAssembly code that renders every other site you visit. Your file is read from disk into memory, processed, and handed back as a download. Once the page has loaded you can disconnect from the network entirely and it keeps working. The longer explanation