JSQLFormatter
manticore-projects.com
- Free plan
- Windows
- macOS
- Linux
- Self-hosted
What JSQLFormatter is
JSQLFormatter is a SQL formatter that parses queries into an abstract syntax tree using a grammar. It formats SELECT, INSERT, MERGE, UPDATE, DELETE, CREATE and ALTER statements, including WITH clauses and nested sub-selects, across the listed Oracle, SQL Server, MySQL, MariaDB, PostgreSQL, H2, DuckDB, BigQuery, Redshift, Databricks and Snowflake dialects. It preserves comments, including those embedded between keywords or in join conditions, while leaving comment-like string values unchanged. You can set indentation, comma placement and casing for keywords, functions and objects per invocation, file or statement. Output options include ANSI terminal highlighting, HTML and RTF. A Java source feature imports SQL strings while retaining variables and can export them as String, StringBuilder or MessageFormat. JSQLFormatter is available as a Java library JAR from Maven Central and as an executable JAR for command-line use. It is free and open source; Apache 2.0 applies from version 5.4 onward, while releases through 5.3 used AGPL.
Who it suits
JSQLFormatter suits developers and database teams who need to format SQL from a command line or Java application. Its dialect coverage and Java source support may also suit teams working across multiple databases or embedding SQL in Java.
Good to know, and what to watch
- Parses SQL with a grammar into an abstract syntax tree.
- Preserves comments and leaves comment-like string literals alone.
- Supports eleven listed SQL dialects.
- Offers terminal, HTML and RTF output.
- Can import SQL strings from Java source.
- Eclipse, JEdit, Squirrel SQL and DBeaver integrations are planned.
- Native dynamic libraries are listed as coming soon.
- Releases through version 5.3 used AGPL.
Plans
Every plan and priceJSQLFormatter
Open source
Getting started
- Open the JSQLFormatter website
- Add the Java library JAR from Maven Central or obtain the executable JAR
- Run it from a Java environment
- Select a supported SQL dialect and statement type
- Configure indentation, comma placement, and casing
- Choose ANSI, HTML, or RTF output
The Club's review
Overview
JSQLFormatter is a platform-independent SQL formatter, beautifier and pretty printer for developers and database teams. It is best suited to Java projects and mixed-dialect environments that need both a library and a command-line executable. Its grammar-based approach and wide statement coverage are compelling, while its integration roadmap is still limited.
Key features
JSQLFormatter parses SQL into an abstract syntax tree with a real grammar instead of regular-expression substitutions. That makes it a sensible choice for complex, nested statements. It handles SELECT, INSERT, MERGE, UPDATE, DELETE, CREATE and ALTER, including WITH clauses and nested sub-selects. Dialect support covers Oracle, SQL Server, MySQL, MariaDB, PostgreSQL, H2, DuckDB, BigQuery, Redshift, Databricks and Snowflake, giving teams that move between database engines a consistent formatter.
Comment preservation is a notable practical advantage. Comments between keywords and inside join conditions remain in place, while string literals that resemble comments are left alone. Formatting can be tailored per invocation, file or statement: teams can set indent width, comma placement, and the casing of keywords, functions and objects without forcing every use case into one global style.
Terminal users can enable ANSI highlighting, while HTML and RTF output suit documentation, wikis and other rich-text destinations. A Java-source mode imports SQL strings while preserving variables and can export them as String, StringBuilder or MessageFormat. That is particularly useful when SQL is embedded in Java rather than stored as standalone files.
The Java library is distributed as a JAR through Maven Central, and an executable JAR provides command-line access. Editor extensions are supported in principle, but the stated platform target is a NetBeans plugin; Eclipse, JEdit, Squirrel SQL and DBeaver are planned. Native dynamic libraries are marked as coming soon, so teams wanting native bindings should look elsewhere for now.
Pricing
The JSQLFormatter plan costs nothing. It is open source and, from version 5.4 onward, licensed under Apache 2.0. That combination suits individual developers, commercial teams and automation pipelines that need to inspect or adapt the code without a subscription. Releases through version 5.3 used AGPL, so projects incorporating an older release should verify that license fits their distribution model.
There are no paid tiers, seat charges, usage quotas or trial-period conditions stated for the free plan. The free offering includes both the Java library and command-line executable, rather than restricting one interface to a higher tier.
Platforms
JSQLFormatter runs on Linux, macOS and Windows, and can be deployed self-hosted. Its Java packaging makes local or build-environment use practical, while the command-line executable supports scripting and automation. The product page describes local Java and command-line operation but makes no security certification or compliance claim, so regulated teams must assess their own requirements.
Who it's for
Choose JSQLFormatter if you maintain Java applications, embed SQL in source code, or standardize formatting across several of the supported database dialects. It also fits documentation workflows that need HTML or RTF output and teams that care about preserving comments in complicated joins.
It is a weaker fit for organizations that require a broad, finished IDE-plugin ecosystem, native libraries today, or documented compliance assurances. NetBeans users have the clearest stated editor path; users of the other named IDEs are waiting on planned integrations.
Pros and cons
Pros
- Grammar-based parsing: AST parsing is a stronger foundation for nested and multi-clause SQL than text substitution.
- Broad coverage: Eleven named dialects and seven major statement families reduce the need for separate formatters.
- Reliable comment treatment: Comments survive formatting without confusing comment-like string literals.
- Java workflow support: Maven Central, an executable JAR and Java-source import/export cover both application code and scripts.
- Flexible output and style: ANSI, HTML and RTF outputs plus per-use casing and layout controls suit different delivery contexts.
Cons
- Integration maturity: Most listed IDE integrations are planned rather than established, and native libraries are not ready.
- License transition: Versions through 5.3 are AGPL, so upgrading or selecting a release matters for redistribution.
- Limited assurance information: No security certification or compliance claim is provided for teams with formal governance needs.
Alternatives
For a directory-wide comparison, see SQL Linters and Formatters.
SQLCheck is a free open-source command-line tool for Linux, macOS and Windows, making it a straightforward alternative when Java packaging and JSQLFormatter's dialect breadth are not priorities.
sqlfmt offers a free browser formatter running through WebAssembly with no installation, better for quick web-based work than local Java or command-line integration.
Poor SQL is a free open-source AGPL option with online and offline formatting plus SSMS and Visual Studio plugins, worth choosing when Microsoft editor integration is more important than Apache 2.0 licensing.
TSQLLint is free MIT-licensed software installable through dotnet-tool, Homebrew or NPM, suited to teams centered on those distribution channels.
SQL Enlight is a paid product with a free trial and a build-machine plan, so it is the alternative to consider when a commercial CI/CD-oriented offering is preferred.
sqlfmt provides a free web plan with 20 analyses per day and all five dialects, fitting light browser use with saved snippets and history.
Sqruff is a free option spanning extensions, desktop platforms, self-hosting and the web.
RegSQL is a freemium browser formatter with unlimited local formatting and 20 AI requests per month on its free plan, for users who want browser-local formatting plus AI assistance.
Verdict
JSQLFormatter is a strong recommendation for Java developers and cross-dialect teams that want one configurable formatter with dependable comment handling and both library and CLI access. Its main reason to choose it is the combination of grammar-based parsing and broad SQL coverage at no cost. Look elsewhere if you need mature IDE plugins beyond the stated NetBeans target, native libraries now, or a documented security and compliance posture.
The verdict
JSQLFormatter offers broad dialect and statement coverage, with options for both command-line and Java use. Check its integration status and the license for the version you plan to use.
Questions people ask
Is JSQLFormatter free?
Yes. The listed plan is free, and it is open source.
Which SQL databases are supported?
The listed dialects are Oracle, SQL Server, MySQL, MariaDB, PostgreSQL, H2, DuckDB, BigQuery, Redshift, Databricks, and Snowflake.
How can I use JSQLFormatter?
It is offered as a Java library JAR from Maven Central and as an executable JAR for command-line use.
What output formats are available?
It supports ANSI terminal highlighting plus HTML and RTF output for documents and wikis.
Does it preserve SQL comments?
Yes. Comments are preserved, including those between keywords or inside join conditions, while comment-like string literals remain unchanged.
What license applies?
JSQLFormatter uses Apache 2.0 from version 5.4 onward. Releases through version 5.3 used AGPL.
What the maker publishes
- Comments
- It preserves comments, including comments between keywords or inside join conditions, and leaves comment-like string literals alone. source
- Configuration
- Indent width, comma placement, and keyword, function and object casing can be configured per invocation, file or statement. source
- Database coverage
- The site lists Oracle, SQL Server, MySQL, MariaDB, PostgreSQL, H2, DuckDB, BigQuery, Redshift, Databricks and Snowflake. source
- Founded
- 2011 source
- IDE integrations
- The site says a NetBeans plugin is a platform target and lists Eclipse, JEdit, Squirrel SQL and DBeaver as planned. source
- Interfaces
- The product is offered as a Java library JAR from Maven Central and as an executable JAR for command-line use. source
- Java source
- It can import SQL strings from Java source while preserving variables and export them as String, StringBuilder or MessageFormat. source
- License
- JSQLFormatter is licensed under Apache 2.0 from version 5.4 onwards; releases through 5.3 were AGPL. source
- Maker
- Manticore Projects describes itself as a consulting company for financial valuation, reporting and credit risk management. source
- Native libraries
- The installation page labels native dynamic libraries as “Coming soon.” source
- Output formats
- It supports ANSI terminal highlighting and HTML and RTF output for documents and wikis. source
- Parsing
- It parses SQL into an abstract syntax tree using a real grammar rather than regular expressions. source
- Purpose
- JSQLFormatter is a platform independent SQL formatter, beautifier and pretty printer. source
- Security and privacy
- The product page describes local Java and command-line use but does not state a security certification or compliance claim. source
- Statement coverage
- It supports SELECT, INSERT, MERGE, UPDATE, DELETE, CREATE and ALTER statements, including WITH clauses and nested sub-selects. source
Checked against the maker's pages on 4 Oct 2026.