Paste your SQL query below to format and beautify it instantly. Transforms minified or messy SQL into clean readable code.
SQL formatting adds indentation, line breaks, and consistent keyword casing to make SQL queries easier to read. When you write a quick query in a database tool or receive SQL generated by an ORM it often comes out as one long line or with inconsistent capitalisation. Formatted SQL is much easier to read, debug, and review. This tool formats, beautifies, and prettifies your SQL instantly in the browser.
Well-formatted SQL also makes it easier to spot performance issues. When each clause sits on its own line you can clearly see what tables are being joined, what conditions are being applied, and what columns are being selected.
These words all describe the same thing. Whether you want to beautify a SQL query, prettify a one-line statement, clean up SQL generated by an ORM, or simply indent a messy script, this tool does it. It takes SQL in any shape, including a single unbroken line, and turns it into clean readable code with each clause on its own line and consistent keyword casing throughout.
The most common convention is to write SQL keywords in uppercase and identifiers like table and column names in lowercase. Each major clause like SELECT, FROM, WHERE, JOIN, GROUP BY, and ORDER BY starts on a new line. Conditions in a WHERE clause are indented and aligned. This tool applies these conventions automatically and lets you switch keyword casing between uppercase and lowercase.
This formatter handles standard SQL syntax which covers the vast majority of statements across every major database. It works with MySQL, PostgreSQL, Microsoft SQL Server, SQLite, and Oracle. Dialect-specific syntax such as PostgreSQL dollar-quoted strings or SQL Server bracket identifiers is passed through unchanged so your query stays valid for your database after formatting.
No. SQL ignores whitespace between tokens. Adding line breaks and indentation has no effect on how the query executes or what results it returns. The formatted query is identical to the original as far as the database is concerned.
This formatter works with standard SQL syntax which covers the most common statements in MySQL, PostgreSQL, SQL Server, SQLite, and Oracle. Dialect-specific syntax like PostgreSQL dollar-quoting or SQL Server bracket identifiers is passed through unchanged.
Yes. Paste a query that is all on a single line and the formatter will break it into properly indented clauses. This is one of the most common uses since SQL logged by applications and generated by ORMs usually comes out as one long line.
Yes. Use the indent control to choose two spaces, four spaces, or a tab. You can also switch keyword casing between uppercase and lowercase to match your team's style.
Yes. Everything runs entirely in your browser. Your SQL is never sent to any server and is not stored anywhere.