SQL Formatter
Paste a cramped one-line query and get properly indented, readable SQL back — with dialect-aware handling for MySQL, PostgreSQL, SQLite and SQL Server, and your choice of keyword casing. Formatting runs locally with the open-source sql-formatter library.
On-device — downloads its library once
Developer
Free · no signup
Network notice: Your queries never leave your device. The open-source formatter (sql-formatter, MIT license) is fetched from the cdnjs CDN the first time you use the tool.
How to use
- Pick the SQL dialect and keyword casing.
- Paste the query (however mangled).
- Click Format and copy the readable version.
Examples
Before
select id,name from users where active=1 order by name
After
SELECT id, name FROM users WHERE active = 1 ORDER BY name
Supported formats
- Dialects: standard SQL, MySQL, PostgreSQL, SQLite, T-SQL.
- 2-space indentation; keywords uppercased, lowercased, or left as typed.
Privacy
Your input is processed in your browser and is never uploaded. The first time you use the tool, your browser downloads its open-source processing library from cdnjs.cloudflare.com — the library is downloaded, your data is not sent. Privacy policy.
Limitations
- This is a formatter, not a validator — syntactically wrong SQL gets formatted as best as possible rather than rejected.
- Vendor-specific procedural blocks (PL/pgSQL bodies, T-SQL procedures) may format imperfectly.
FAQ
Does formatting change what the query does?
No — only whitespace, line breaks and keyword casing change. Identifiers, strings and semantics are untouched.
Is my query sent to a server?
No. Formatting runs in your browser, so queries containing table names or embedded data stay private.