Google Closure Compiler
developers.google.com
What it is
Google Closure Compiler optimizes JavaScript by analyzing code, removing dead code, and rewriting and minimizing what remains. It can also check syntax, references, and types, and warn about illegal JavaScript, risky operations, and common pitfalls. Google says smaller output files can help applications load faster and reduce bandwidth needs. Compilation options include WHITESPACE_ONLY, SIMPLE, and ADVANCED; the repository README also lists BUNDLE. ADVANCED applies aggressive transformations and symbol renaming to improve compression, so preserving program behavior requires care. The project is available as a command-line Java application, a library used through Bazel, and an NPM package. Released JARs are distributed through Maven. The repository documents Maven, NPM, Bazel, command-line Java, and a NodeJS API. Building the compiler requires Java 21 or later, NodeJS, Git, and Bazelisk. Its input restrictions include use of goog.module() and goog.require(), and ES6 import/export support is not actively maintained. The NPM packages are built and distributed by an open source contributor, not Google. The compiler is free.
Spec sheet
- Purpose
- Closure Compiler optimizes JavaScript by analyzing it, removing dead code, rewriting and minimizing what remains, and checking syntax, references, and types.Read 4 Oct 2026 · developers.google.com
- Integrations
- The repository documents a NodeJS API and use through Maven, NPM, Bazel, and command-line Java.Read 4 Oct 2026 · github.com
- Advanced optimization
- ADVANCED_OPTIMIZATIONS can improve compression through aggressive transformations and symbol renaming, and requires care to preserve program behavior.Read 4 Oct 2026 · developers.google.com
- Build requirements
- The repository README lists Java 21 or later, NodeJS, Git, and Bazelisk as requirements to build the compiler.Read 4 Oct 2026 · github.com
- Code checking
- The compiler warns about illegal JavaScript, potentially dangerous operations, and common JavaScript pitfalls.Read 4 Oct 2026 · developers.google.com
- Compilation modes
- Available compilation levels include WHITESPACE_ONLY, SIMPLE, and ADVANCED; the repository README also lists BUNDLE.Read 4 Oct 2026 · github.com
- Distribution
- The project page directs users to download a released JAR from Maven, and the repository README also documents Maven distribution.Read 4 Oct 2026 · developers.google.com
- File efficiency
- Google says the compiler reduces JavaScript file size and can help applications load faster while reducing bandwidth needs.Read 4 Oct 2026 · developers.google.com
- Help
- Google’s FAQ directs users to the Closure Compiler Discuss Group, Stack Overflow, and the FAQ itself for help.Read 4 Oct 2026 · developers.google.com
- Intended use
- The repository says Google projects use Closure Compiler to reduce JavaScript size, check code, support localization, transpile newer JavaScript features, and split output into loadable chunks.Read 4 Oct 2026 · github.com
- JavaScript restrictions
- The repository says Closure Compiler places restrictions on input, including use of goog.module() and goog.require(), and that ES6 import/export support is not actively maintained.Read 4 Oct 2026 · github.com
- NPM package
- The repository README states that NPM packages are built and distributed by an open source contributor, not by Google.Read 4 Oct 2026 · github.com
- Security and compliance
- The project page links to the Apache 2.0 license for code samples; it does not state a security certification or compliance standard.Read 4 Oct 2026 · developers.google.com
- Ways to use
- The project page describes an open source command-line Java application, a library used via Bazel, and an NPM package.Read 4 Oct 2026 · developers.google.com
Plans and prices
Strong points and limits
Strong points
- Offers three compilation levels, plus BUNDLE in the repository README.
- Checks syntax, references, and types.
- Available through Java, Bazel, and NPM.
- Documents a NodeJS API and Maven distribution.
- Free to use.
Limits
- ADVANCED transformations require care to preserve behavior.
- ES6 import/export support is not actively maintained.
- Building requires Java 21 or later, NodeJS, Git, and Bazelisk.
- Input restrictions include goog.module() and goog.require().
Who it suits
It suits JavaScript developers seeking code optimization and static checks, particularly those able to work within its input restrictions. Teams considering ADVANCED optimization should account for the care needed to preserve behavior.
Verdict
Closure Compiler pairs JavaScript optimization with code checks and several documented ways to use it. Its input restrictions and the caution required for ADVANCED mode are important fit considerations.
Where Specifiction places it
- JavaScript Build Tools#6 of 278.1