Format SQL queries
Beautify SQL live, MySQL and PostgreSQL aware.
Files stay on your device. No accounts. Free.
Loading tool...
About this tool
Paste a one-line query and get it laid out properly: clauses on their own lines, sane indentation, keywords uppercased if you want. Dialect-aware formatting for standard SQL, MySQL, PostgreSQL and SQLite.
Queries frequently contain table names, filters and sometimes literal data you should not paste into random websites; here formatting runs entirely in your browser via the open source sql-formatter library.
How it works
- Paste your input, or drop a text file onto the box.
- The output updates live as you type.
- Copy it to the clipboard, or download it as a file.
Frequently asked questions
Which SQL dialects are supported?
Standard SQL, MySQL, PostgreSQL and SQLite. Pick the one you use so dialect-specific syntax like backticks or casts formats correctly.
Does formatting change what the query does?
No, it only changes whitespace, line breaks and keyword casing. The statement stays semantically identical.
Is it safe to paste production queries here?
Yes. The formatter is a JavaScript library running in your browser tab; the query text is never transmitted anywhere.