SQL Formatter

Format and beautify SQL queries instantly. Keywords uppercased, predictable indentation, multi-dialect syntax.

Free online SQL formatter. Beautify messy queries with consistent indentation and uppercased keywords. Works with PostgreSQL, MySQL, SQL Server and SQLite syntax.

Frequently asked questions

Does the formatter execute my SQL?

No. It only rewrites the whitespace and casing. The query is never parsed semantically, connected to a database, or sent anywhere. You can safely paste production queries; the formatter runs entirely in your browser.

Which SQL dialects does it understand?

It handles the common subset used by PostgreSQL, MySQL, SQL Server and SQLite, sELECT, INSERT, UPDATE, DELETE, JOINs, CTEs, window functions, and subqueries. Vendor-specific extensions (Postgres arrays, MySQL ENUMs) pass through untouched.

Why are my comments moved to strange places?

Single-line comments (--) get detached from their line when the formatter re-indents the statement. Prefer block comments (/* … */) placed on their own line for formatter-stable output.

All free developer tools