- Home
- SQL Linters and Formatters
- SQL Formatter
SQL Formatter
What it is
SQL Formatter is a free, open-source JavaScript library for pretty-printing SQL queries. It supports many dialects, including Standard SQL, BigQuery, ClickHouse, IBM DB2 and DB2i, DuckDB, Hive, MariaDB, MySQL, TiDB, Couchbase N1QL, Oracle PL/SQL, PostgreSQL, Redshift, SingleStoreDB, Snowflake, Spark, SQLite, SQL Server Transact-SQL, and Trino/Presto. Formatting settings cover indentation, keyword and data-type case, function and identifier case, logical-operator placement, expression width, spacing between queries, and operator spacing. The library can replace prepared-statement placeholders when parameter values are supplied. Its command-line tool reads SQL from standard input or a file, writes formatted output, or updates a file in place. VS Code and Vim extensions, Prettier and ESLint integrations, and a JSON Schema for configuration completion are listed. A browser demo exposes formatting controls. It is MIT licensed, offers automatic fixes, and is available on extension, Linux, macOS, web, and Windows platforms.
For and against
For
- Free, open-source MIT-licensed library
- Supports numerous SQL dialects
- Command-line input and in-place updates
- Editor extensions and integrations
- Configurable formatting controls
Against
- Stored procedures are unsupported
- Delimiter cannot change from semicolon
- Templating syntax lacks direct support
- Maintainer describes maintenance mode
The verdict
SQL Formatter combines broad dialect coverage with configurable formatting, command-line use, and editor integrations at no cost. Check its stored-procedure, delimiter, templating, and maintenance limitations before adopting it.
Who it suits
It suits developers who need configurable SQL formatting across several dialects and editor or command-line workflows. It also fits users wanting a free, MIT-licensed library with browser access.
Plans and prices
Free
SQL formatting library and browser demo · MIT licensed
Read 4 Oct 2026 · github.com
On the record
- Browser demo
- The official demo page exposes controls for language, indentation, case, operator newlines, expression width, and query spacing.sql-formatter-org.github.io · read 4 Oct 2026
- CLI
- The command line tool accepts SQL from standard input or a file and can write formatted output or update a file in place.github.com · read 4 Oct 2026
- Configuration schema
- The project provides a JSON Schema for configuration-file autocompletion and IntelliSense in editors, with usage guides for VS Code and Zed.github.com · read 4 Oct 2026
- Dialects
- It supports BigQuery, ClickHouse, DB2, DuckDB, Hive, MariaDB, MySQL, TiDB, Couchbase N1QL, Oracle PL/SQL, PostgreSQL, Redshift, SingleStoreDB, Snowflake, Spark, SQL Server Transact-SQL, and Trino/Presto.github.com · read 4 Oct 2026
- Editor integrations
- The project lists VS Code and Vim extensions, a Prettier plugin, and an ESLint plugin integration.github.com · read 4 Oct 2026
- Formatting options
- Options include indentation, keyword and data type case, function and identifier case, logical operator placement, expression width, spacing between queries, and operator spacing.github.com · read 4 Oct 2026
- License
- The software is released under the MIT license.github.com · read 4 Oct 2026
- Limits
- It does not support stored procedures or changing the delimiter from a semicolon.github.com · read 4 Oct 2026
- Maintenance
- The maintainer says the formatter is in maintenance mode, with feasible bug fixes and likely no new features.github.com · read 4 Oct 2026
- Placeholder replacement
- The library can replace placeholders in prepared SQL statements using supplied parameter values.github.com · read 4 Oct 2026
- Purpose
- SQL Formatter is a JavaScript library for pretty-printing SQL queries.github.com · read 4 Oct 2026
- Templating
- Templating syntax is not directly supported; the README describes a parameter-type workaround that may not cover every templating construct.github.com · read 4 Oct 2026