Skip to the content
Know your tech before you buy it. Makers: get listed from $49/mo

SQL Formatter

sql-formatter-org.github.io

  • Free plan
  • Windows
  • macOS
  • Linux
  • Web
  • Browser extension

What SQL Formatter is

SQL Formatter is a free, MIT-licensed JavaScript library for making SQL queries easier to read. Its formatting controls cover indentation, keyword and data type case, 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 and can print formatted output or update a file in place. The project lists VS Code and Vim extensions, a Prettier plugin and an ESLint integration. A JSON Schema supports configuration-file completion and IntelliSense, with guides for VS Code and Zed. The library can replace prepared-statement placeholders when given parameter values, and a browser demo provides formatting controls. It does not support stored procedures or changing the delimiter from a semicolon. Templating syntax is not directly supported; the maintainer describes the project as being in maintenance mode, with feasible bug fixes and likely no new features.

Who it suits

It suits developers who need configurable SQL formatting in a JavaScript project, command line, browser demo or listed editor integrations. Check its dialect support and limitations before relying on it for procedures or templated SQL.

Good to know, and what to watch

  • Supports a broad set of SQL dialects.
  • Offers configurable formatting options.
  • CLI can update a file in place.
  • Lists VS Code and Vim extensions.
  • MIT licensed and free.
  • Does not support stored procedures.
  • Delimiter changes from semicolon are unsupported.
  • Templating syntax is not directly supported.
  • Maintainer says new features are unlikely.

Free

Free

Open source

The verdict

SQL Formatter provides flexible formatting and several ways to integrate it into a workflow. Its maintenance status and limits around procedures, delimiters and templating are important considerations.

What the maker publishes

Browser demo
The official demo page exposes controls for language, indentation, case, operator newlines, expression width, and query spacing. source
CLI
The command line tool accepts SQL from standard input or a file and can write formatted output or update a file in place. source
Configuration schema
The project provides a JSON Schema for configuration-file autocompletion and IntelliSense in editors, with usage guides for VS Code and Zed. source
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. source
Editor integrations
The project lists VS Code and Vim extensions, a Prettier plugin, and an ESLint plugin integration. source
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. source
License
The software is released under the MIT license. source
Limits
It does not support stored procedures or changing the delimiter from a semicolon. source
Maintenance
The maintainer says the formatter is in maintenance mode, with feasible bug fixes and likely no new features. source
Placeholder replacement
The library can replace placeholders in prepared SQL statements using supplied parameter values. source
Purpose
SQL Formatter is a JavaScript library for pretty-printing SQL queries. source
Templating
Templating syntax is not directly supported; the README describes a parameter-type workaround that may not cover every templating construct. source

Checked against the maker's pages on 4 Oct 2026.