Webtools

SQL Formatter

Pretty-print SQL with consistent indentation

About the SQL Formatter

Paste any SQL query — SELECT, INSERT, UPDATE, DELETE, CTEs — and get a cleanly indented version with major clauses on their own lines, AND/OR conditions stacked, and column lists broken across lines. Optionally uppercase keywords for visual contrast.

String literals and comments (-- and /* */) are preserved verbatim. The formatter is dialect-agnostic — it works for PostgreSQL, MySQL, SQLite, SQL Server, and Snowflake.

Frequently asked questions

Does it validate or execute the SQL?
No — only formats. Syntactically invalid SQL still gets indented; it just won't run. Use your database client to validate or run queries.
Are subqueries indented?
Yes. Subqueries inside parentheses are indented one level deeper, and major clauses inside them break onto their own lines as usual.

Related tools

JSON Formatter
Format, validate, and minify JSON with syntax highlighting
Base64 Encoder
Encode and decode Base64 strings
URL Encoder
URL encode and decode strings
JWT Decoder
Decode JWT tokens and inspect header, payload, and signature
Browse other categories: Word Tools· Number Tools· Text Tools· Converters· Color Tools· Time Tools· Random Generators