SQL Formatter
Beautify SQL queries for MySQL, PostgreSQL and more.
Free
Runs in your browser
About this tool
SQL Formatter turns a long one-line query into clean, indented SQL that is easy to read and review. Pick your database dialect so its keywords and syntax are handled correctly.
How to use SQL Formatter
- Paste your SQL query.
- Choose the dialect, keyword case and indent.
- Copy the formatted SQL.
Questions people ask
Which databases are supported?
Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift and Spark SQL.
Does formatting change what the query does?
No. Only whitespace, line breaks and optionally keyword case change. Strings, identifiers and logic stay the same.
Why does formatting fail?
The parser stops on syntax it does not know, such as a typo or a feature from another dialect. Try a different dialect or fix the line it reports.
More developer tools
See all 24 →
HTML FormatterBeautify and indent messy HTML code.
CSS FormatterBeautify minified CSS into readable rules.
JavaScript FormatterBeautify minified JavaScript with clean indents.
HTML MinifierShrink HTML by removing comments and whitespace.
CSS MinifierCompress CSS by stripping comments and spaces.
JavaScript MinifierRemove comments and whitespace from JavaScript.