/sql-formatter

SQL Query Formatter & Minifier

Clean, format, and indent your SQL queries or compress database statements locally in your browser.

Source SQL Query
Formatted Result

Frequently Asked Questions

What does formatting SQL do?
It reorganizes query blocks, breaks long SELECT and JOIN statements into readable lines, capitalizes database keywords, and indents nested constraints.
Why should I minify SQL?
Minification strips out line breaks, comments, and extra space characters to compress the query string. This is useful when embedding SQL in application settings.
Which SQL dialects are supported?
It formats standard SQL syntax. It is fully compatible with MySQL, PostgreSQL, MS SQL, SQLite, Oracle, and MariaDB queries.
Is my database schema safe?
Yes. Because all parsing and syntax formatting are processed client-side via JavaScript, your table structures and queries are never sent to a server.