SQL Formatter
sql-formatter-org.github.io
What it is
SQL Formatter is a free, MIT-licensed JavaScript library for pretty-printing SQL queries, with a browser demo and command-line tool. Formatting options include indentation; keyword, data type, function, and identifier case; logical operator placement; expression width; query spacing; and operator spacing. It supports dialects including 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. The command-line tool accepts SQL from standard input or a file, can produce formatted output, and can update a file in place. The project also lists VS Code and Vim extensions, a Prettier plugin, and an ESLint integration. Its JSON Schema supports configuration-file autocompletion and IntelliSense, with usage guides for VS Code and Zed. The library can replace prepared-statement placeholders when parameter values are supplied. It does not support stored procedures or changing the delimiter from a semicolon. Templating syntax is not directly supported; a parameter-type workaround may not cover every construct. The maintainer describes the project as being in maintenance mode, with feasible bug fixes and likely no new features.
Spec sheet
- Purpose
- SQL Formatter is a JavaScript library for pretty-printing SQL queries.Read 4 Oct 2026 · github.com
- License
- The software is released under the MIT license.Read 4 Oct 2026 · github.com
- Browser demo
- The official demo page exposes controls for language, indentation, case, operator newlines, expression width, and query spacing.Read 4 Oct 2026 · sql-formatter-org.github.io
- CLI
- The command line tool accepts SQL from standard input or a file and can write formatted output or update a file in place.Read 4 Oct 2026 · github.com
- Configuration schema
- The project provides a JSON Schema for configuration-file autocompletion and IntelliSense in editors, with usage guides for VS Code and Zed.Read 4 Oct 2026 · github.com
- 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.Read 4 Oct 2026 · github.com
- Editor integrations
- The project lists VS Code and Vim extensions, a Prettier plugin, and an ESLint plugin integration.Read 4 Oct 2026 · github.com
- 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.Read 4 Oct 2026 · github.com
- Limits
- It does not support stored procedures or changing the delimiter from a semicolon.Read 4 Oct 2026 · github.com
- Maintenance
- The maintainer says the formatter is in maintenance mode, with feasible bug fixes and likely no new features.Read 4 Oct 2026 · github.com
- Placeholder replacement
- The library can replace placeholders in prepared SQL statements using supplied parameter values.Read 4 Oct 2026 · github.com
- Templating
- Templating syntax is not directly supported; the README describes a parameter-type workaround that may not cover every templating construct.Read 4 Oct 2026 · github.com
Plans and prices
Strong points and limits
Strong points
- MIT licensed and free.
- Supports a wide range of SQL dialects.
- Command line can update files in place.
- Lists VS Code and Vim extensions.
- Provides a configuration JSON Schema.
Limits
- Stored procedures are unsupported.
- Delimiter cannot change from a semicolon.
- Templating syntax is not directly supported.
- Project is in maintenance mode.
Who it suits
It suits developers who want configurable SQL formatting through a JavaScript library, command line, browser demo, or listed editor integrations. Users relying on stored procedures, delimiter changes, or templating syntax should note the stated limitations.
Verdict
SQL Formatter offers configurable formatting across many dialects and several development workflows. Its stated SQL limitations and maintenance status matter for projects expecting broader syntax support or new features.
Where Specifiction places it
- SQL Linters and Formatters#13 of 267.7