SQL Formatter / Beautifier
Beautify and standardize SQL queries across MySQL, PostgreSQL, SQLite, BigQuery, and Spark dialects.
About this tool
The SQL Formatter takes minified, copy-pasted, or inconsistently indented SQL and reformats it into clean, readable output with proper keyword casing and consistent indentation. Paste a query from a log file, an ORM debug dump, or a colleague's Slack message and get back SQL you can actually read and review.
Six dialects are supported — Standard SQL, MySQL, PostgreSQL, SQLite, BigQuery, and Spark — each with its own keyword set and quoting conventions handled correctly by the underlying sql-formatter engine. You can choose uppercase, lowercase, or preserved keyword casing to match your team's style guide, and pick 2-space or 4-space indentation.
Formatting runs entirely in your browser using the sql-formatter JavaScript library — no query text, table names, or embedded literals are ever sent to a server. This matters when working with production queries that may contain sensitive filter values or internal schema names. Open your browser's Network panel while using it and you will see zero outbound requests.
Common uses: cleaning up SQL before a code review, formatting dynamically generated queries from an ORM for debugging, standardizing SQL style across a team, and making deeply nested subqueries and JOINs readable at a glance.
