Skip to content
SPECIFICTION
Get listed

JSQLFormatter vs pgFormatter

JSQLFormatter

manticore-projects.com

pgFormatter

github.com

Side by side

FigureJSQLFormatterpgFormatter
Price fromFreeFree
Free planYesYes
Free trial——
Open source——
Web—Yes
WindowsYes—
macOSYes—
LinuxYesYes
API—Yes
Self-hostedYesYes
Plans published11
Spec score · SQL Linters and Formatters8.3 (#5)8.2 (#6)
PurposeJSQLFormatter is a platform independent SQL formatter, beautifier and pretty printer.pgFormatter beautifies PostgreSQL SQL queries and PL/pgSQL code, and supports keywords from several SQL standards as well as PostgreSQL-specific keywords.
Security and privacyThe product page describes local Java and command-line use but does not state a security certification or compliance claim.The anonymization option is described as useful for hiding confidential data before formatting; the repository page opened did not state security certifications or compliance claims.

Plans

JSQLFormatter

  • JSQLFormatterFree

JSQLFormatter pricing →

pgFormatter

  • pgFormatterFree

pgFormatter pricing →

In their own words

JSQLFormatter

JSQLFormatter formats SQL for terminal output, documents, and wikis, and is available as a Java library or command-line executable. It parses SQL with a grammar into an abstract syntax tree rather than relying on regular expressions. Supported statements include SELECT, INSERT, MERGE, UPDATE, DELETE, CREATE, and ALTER, including WITH clauses and nested sub-selects. The listed dialects cover Oracle, SQL Server, MySQL, MariaDB, PostgreSQL, H2, DuckDB, BigQuery, Redshift, Databricks, and Snowflake. Formatting can preserve comments between keywords or within join conditions, while leaving comment-like string literals unchanged. Users can configure indentation, comma placement, and the casing of keywords, functions, and objects, with settings applied 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 free. Its license is Apache 2.0 from version 5.4 onward; releases through 5.3 were AGPL. A NetBeans plugin is a platform target, while Eclipse, JEdit, Squirrel SQL, and DBeaver are listed as planned.

Visit manticore-projects.com

pgFormatter

pgFormatter is free software for formatting PostgreSQL SQL queries and PL/pgSQL code. It supports SQL-92, SQL-99, SQL-2003, SQL-2008, SQL-2011 and PostgreSQL syntax, and the project says it also works with other databases. You can run it as a console program or CGI application that returns text or HTML; a CGI request with an application/json Accept header can return JSON. Formatting controls cover keyword, function, identifier and type case, indentation, query wrapping and comma placement. The --anonymize option hides query literals before formatting. The project documents source installation with Perl Makefile.PL, make and make install, Docker use, Vim and (Neo)Vim integration, Atom and Visual Studio Code links, and a pre-commit hook for SQL files. An online demo limits queries to ten thousand characters. It is distributed under the PostgreSQL Licence at free.

Visit github.com