How SQL Formatting Works
AnyTool formats SQL with the tokenizer-based sql-formatter library, which supports 17 dialects (Postgres, MySQL, MariaDB, SQL Server/T-SQL, PL/SQL, BigQuery, Snowflake, Redshift, SQLite, DuckDB, Spark, ClickHouse, Trino, DB2, N1QL, and standard SQL). Because it tokenizes rather than using regex, it correctly handles subqueries, CTEs, CASE expressions, and window functions, and preserves -- and /* */ comments and string literals. Options control keyword/identifier/data-type case and indentation, with a minify mode. The library is bundled (no runtime CDN) and runs in-browser, so queries are never uploaded.
- 17 dialects via tokenizer-based sql-formatter
- Comment- and string-literal safe
- Keyword/identifier/data-type case control
- Handles subqueries, CTEs, CASE, window functions
- Bundled, no runtime CDN; no upload
