Tool
SQL formatter and whitespace compressor
Format PostgreSQL, SQLite and Transact-SQL locally with indentation and keyword options, or compress whitespace while preserving quoted text and comments. Worker processing, original-text recovery and SQL download.
1. Original SQL
Entirely local: no database connection, query execution, upload or persistence. The input stays unchanged while the result is shown separately.
Text formatting, not syntax validation. Success only means the formatter accepted the text; it does not prove SQL correctness, safety or performance. Verify your database semantics separately.
Other dialects (including MySQL, Oracle and BigQuery) are not supported in this first version. Do not select a different dialect to force a result. PostgreSQL assumes standard-conforming strings; custom server modes and procedural dialect extensions are not validated.
2. Text result
Compression and parser limits
Compression collapses only whitespace outside quoted text and comments to a single space (PostgreSQL line breaks are retained for adjacent-string semantics). It preserves line-comment newlines, comment contents, quote escapes and necessary token separation; strings, quoted identifiers, dollar-quoted text and optimizer hints are not stripped. Formatting settings apply only to Format. Original text is never overwritten automatically.
sql-formatter 15.9.0 handles layout in a worker. Limits: 500,000 characters and a 3-second processing timeout. Unterminated quotes/comments, unbalanced brackets, unsupported syntax or protected-text changes produce a located error instead of replacement SQL. The formatter is not a full database parser, so SQL that formats successfully can still be invalid. Database-specific extensions may be rejected; keep the original and check in your database tools.
FAQ
Does formatting validate or execute SQL?
No. This only formats text. The formatter is not a full database parser and accepted text may still be invalid. No database connection, execution, optimization or performance check occurs.
Which dialects are supported?
This version explicitly supports PostgreSQL, SQLite and Transact-SQL, with SELECT, JOIN, CTE, nested-query, comment and string tests. Other dialects are rejected; do not select a different dialect to force a result.
Will compression remove comments or alter strings?
No. It only collapses whitespace outside protected strings, quoted identifiers and comments. Line-comment newlines, escaped quotes, dollar-quoted text and token separation are retained. Unsafe or unterminated text is rejected.
Can I keep or restore the original?
Yes. Results appear separately and never overwrite input automatically. Use the original-text button to return to it; applying the result as input is undoable. Processing runs in a local worker with a timeout; no input is uploaded or stored.