Developer tool

SQL Formatter & Beautifier

Format and beautify SQL for SQL Server, PostgreSQL, MySQL and standard SQL. Comments, strings and quoted identifiers are preserved exactly.

USING THIS TOOL

How the SQL Formatter helps

Queries copied from logs, ORMs, Power BI or a colleague's one-liner are hard to read and harder to review. The formatter puts each clause on its own line, lists selected columns one per line, indents joins, conditions, CASE expressions and subqueries, and applies consistent keyword casing — while leaving your strings, comments and quoted identifiers byte-for-byte unchanged.

Safe by design

The formatter only changes whitespace and the case of SQL keywords. After formatting it re-reads the result and compares every token with your original; if anything other than layout would change, it refuses and leaves your query untouched. It is a formatter, not a validator: it does not check that tables or columns exist.

Dialects

Choose SQL Server for [bracketed] identifiers and GO batch separators, PostgreSQL for $$ dollar-quoted bodies, :: casts and JSON operators, and MySQL for `backtick` identifiers, # comments and backslash escapes in strings.

Frequently asked questions

Is my SQL sent to a server?

No. Formatting runs entirely in your browser, so it is safe to use with internal queries.

Does it change my query's behaviour?

No. Only whitespace and keyword case change, and a built-in check compares the tokens before and after formatting.

Can I format several statements at once?

Yes. Separate statements with semicolons (or GO in SQL Server) and each one is formatted with a blank line between them.

Know the limits

Very unusual vendor syntax may be laid out conservatively. Procedural code (stored procedures, PL/pgSQL bodies) is kept readable but not fully re-indented.