Back to SQL Formatter
Documentation & FAQ

How SQL Formatter Works

Engineered for high-fidelity SQL formatting across 9+ database dialects with native AST parsers, side-by-side Git diff verification, and zero-retention formatting by default.

Core Architecture & AST Engine

Understanding why Abstract Syntax Tree parsing delivers superior reliability over regular expressions.

GoogleSQL & ZetaSQL AST

BigQuery queries are parsed using native GoogleSQL / ZetaSQL C++ engines. This supports complex GoogleSQL features including Pipe Syntax (|>), STRUCTs, ARRAYs, and procedural scripts without token corruption.

SQLFusion Rust Engine

PostgreSQL, MySQL, SQL Server, ClickHouse, Snowflake, DuckDB, SQLite, and ANSI queries are formatted using SQLFusion, a high-performance AST engine written in Rust built on Apache DataFusion sqlparser-rs that handles dialect-specific syntax quirks.

Git Diff Inspection

Integrated Git-style diff inspection visualizes every line break, keyword case adjustment, and indentation change before you copy or apply queries to production.

Privacy-First Formatting

Enterprise-ready security boundary

We understand that SQL queries often contain sensitive database schemas, proprietary business logic, and internal identifiers. Our system operates under strict privacy principles:

No Server-Side StorageRequests use ephemeral memory; only your browser retains the current editor draft.
No Query LoggingFormatting payloads are excluded from application logging layers.
No Model TrainingYour queries are never used to train or tune AI models.
HTTPS TLS EncryptionAll data in transit is encrypted using modern TLS.

Internal formatter failures may offer an optional private bug report. Nothing is sent to the private tracker unless you review the editable query and explicitly consent to submit it.

Supported Dialects Breakdown

Engine support and key capabilities across all supported SQL dialects.

DialectEngineKey Capabilities
BigQuery (GoogleSQL)GoogleSQLNative GoogleSQL & ZetaSQL AST parsing engine · Full support for ARRAYs, STRUCTs, and UNNEST expressions · GoogleSQL Pipe Syntax (|>) support · Multi-statement procedural scripts & DDL formatting · Backtick-escaped project and dataset identifiers
PostgreSQLSQLFusionRecursive CTEs and Common Table Expressions · JSON and JSONB path extraction operators (->, ->>, #>) · Window functions with PARTITION BY and custom frame specifications · FILTER (WHERE ...) aggregation clauses · Dollar-quoted string literals and arrays
MySQLSQLFusionBacktick identifier escaping (`table`.`column`) · HAVING and GROUP BY clauses with aggregate filters · String and date functions (DATE_FORMAT, COALESCE, IFNULL) · INNER, LEFT, RIGHT, and FULL OUTER JOIN indentation
SQL Server (T-SQL)SQLFusionSquare bracket identifier escaping ([dbo].[TableName]) · TOP (N) and OFFSET-FETCH pagination clauses · CROSS APPLY and OUTER APPLY joins · Common Table Expressions (WITH CTE)
ClickHouseSQLFusionClickHouse PREWHERE and WHERE clauses · Nested aggregation combinators (-State, -Merge, -ExactWeighted) · Array manipulation and lambda functions · DateTime functions and interval expressions
SnowflakeSQLFusionSnowflake colon type casting (::type) · Semi-structured JSON path queries and FLATTEN · Stage references and warehouse commands · Window functions and analytical clauses
DuckDBSQLFusionDuckDB parquet, JSON, and CSV reader functions · List and struct transformations · QUALIFY clauses and regex matching · Positional reference and columns expression
SQLiteSQLFusionStandard SQLite queries and PRAGMA statements · JSON functions (json_extract, ->, ->>) · CTE and window function support · Transactions and savepoints
Generic / ANSI SQLSQLFusionStandard ANSI SQL:1999/2011 compliant formatting · Common Table Expressions (WITH clauses) · Standard JOINs (INNER, LEFT, RIGHT, FULL OUTER) · Window functions and aggregate subqueries

Frequently Asked Questions

Answers to common questions regarding formatting, dialect behavior, and features.

What makes this formatter different from traditional online SQL formatters?
Traditional online formatters rely on regular expressions or naive tokenizers that cannot understand language grammar. When handling nested CTEs, JSON operators, lambda expressions, or modern features like GoogleSQL pipe syntax, naive formatters frequently mangle syntax. Our service parses your query into an Abstract Syntax Tree (AST) using native C++ and Rust parser engines, guaranteeing syntactic accuracy and preserving code semantics.
Which parsing engines power the formatters?
BigQuery and GoogleSQL queries are formatted using authentic GoogleSQL / Google ZetaSQL C++ AST binaries. PostgreSQL, MySQL, SQL Server, ClickHouse, Snowflake, DuckDB, SQLite, and Generic ANSI SQL queries are parsed and formatted using SQLFusion, a high-performance AST formatting engine implemented in Rust, built on Apache DataFusion sqlparser-rs.
Is my SQL query saved, logged, or retained on your servers?
Normal formatting requests are processed in ephemeral memory and are not logged or retained on our servers. Your current editor draft is stored only in your browser's local storage so it survives reloads. If an internal formatter failure occurs, you may explicitly submit an editable copy of the query and its formatting context to our private bug tracker for investigation.
Does the formatter support multi-statement SQL scripts?
Yes. You can format full multi-statement SQL scripts, DDL batches, transaction blocks, and procedural routines separated by semicolons. The formatter parses each statement within the script while preserving statement boundaries, comments, and configurable statement separation options (such as always_break_query).
How does the side-by-side Git diff viewer work?
After formatting, you can toggle the side-by-side Git diff view to inspect every single whitespace, keyword capitalization, and indentation modification side-by-side against your original raw SQL. This lets you visually verify all structural transformations before applying them to production code.
Does the formatter support GoogleSQL Pipe Syntax (|>)?
Yes. GoogleSQL Pipe Syntax is fully supported as a first-class language construct. You can format complex pipe chains including |> WHERE, |> AGGREGATE, |> EXTEND, |> SET, |> JOIN, and |> WINDOW with custom pipe breaking rules.
What happens if my query contains syntax errors?
Because the parser evaluates the AST, any syntactic errors (such as unclosed parentheses, missing clauses, or invalid keywords) will be identified with descriptive error messages detailing where the parser encountered the failure.
Is there an API available for programmatic formatting or CI/CD pipelines?
Yes. You can invoke our formatting service programmatically via a standard JSON Connect RPC endpoint. Check our API documentation page for cURL, TypeScript, and Python code examples.

Ready to format your queries?

Try our instant multi-dialect formatter with live diff inspection and custom formatting rules.

Open SQL Formatter