SQL Formatter & Beautifier
Format SQL queries. Supports PostgreSQL, MySQL, SQLite, MariaDB, BigQuery and more.
About SQL Formatter & Beautifier
Paste any SQL query — no matter how minified or messy — and get a properly indented, readable result. Choose your SQL dialect for accurate keyword casing and syntax handling: PostgreSQL, MySQL, SQLite, MariaDB, BigQuery, Spark, and more. Useful for reading ORM-generated queries, formatting migration scripts, or preparing queries for code review.
All processing happens entirely in your browser using modern web APIs. Nothing is uploaded to our servers — your data stays local and private. Free to use forever.
Common use cases
- Formatting minified ORM-generated SQL queries for debugging
- Beautifying SQL before committing to version control
- Reading and understanding complex multi-join queries
- Standardizing SQL style in a team codebase
- Formatting queries copied from database error logs
How it works
Uses the sql-formatter library which tokenizes the SQL input and rebuilds it with proper indentation, keyword capitalization, and newlines based on the selected dialect. Keywords like SELECT, FROM, WHERE, JOIN get their own lines; nested clauses are indented; subqueries are formatted recursively.