- Home
- JavaScript Build Tools
- Google Closure Compiler
Google Closure Compiler
What it is
Google Closure Compiler is a free tool for analyzing and optimizing JavaScript. It can remove unused code, rewrite and minimize what remains, and check syntax, references, and types. Google says smaller JavaScript files can help applications load faster and reduce bandwidth needs. It also warns about illegal JavaScript, potentially dangerous operations, and common pitfalls. Compilation levels include WHITESPACE_ONLY, SIMPLE, and ADVANCED; the repository README also lists BUNDLE. ADVANCED_OPTIMIZATIONS uses aggressive transformations and renames symbols to improve compression, so preserving program behavior requires care. The project is available as a command-line Java application, a Bazel library, and an NPM package. Released JAR files are available through Maven. The NPM packages are built and distributed by an open source contributor, not Google. Building the compiler requires Java 21 or later, NodeJS, Git, and Bazelisk. The repository documents input restrictions, including use of goog.module() and goog.require(), and says ES6 import/export support is not actively maintained.
For and against
For
- Free plan; open source Java application
- Checks syntax, references, and types
- Offers multiple compilation levels
- Supports code splitting and tree shaking
- Includes a NodeJS API
Against
- Requires Java 21 or later to build
- ES6 import/export support is not actively maintained
- ADVANCED optimization requires care to preserve behavior
The verdict
Closure Compiler combines JavaScript optimization with code checks and several ways to integrate it into a build. Review its input restrictions and build requirements, especially if you plan to use ADVANCED optimization.
Who it suits
Closure Compiler suits JavaScript developers who want to reduce output size and check code, including teams that build through Java, Bazel, or NPM. Its advanced mode and documented input restrictions are worth considering before adopting it.
Plans and prices
Closure Compiler
Open source Java application · Bazel library · NPM package
Read 4 Oct 2026 · developers.google.com
On the record
- Advanced optimization
- ADVANCED_OPTIMIZATIONS can improve compression through aggressive transformations and symbol renaming, and requires care to preserve program behavior.developers.google.com · read 4 Oct 2026
- Build requirements
- The repository README lists Java 21 or later, NodeJS, Git, and Bazelisk as requirements to build the compiler.github.com · read 4 Oct 2026
- Code checking
- The compiler warns about illegal JavaScript, potentially dangerous operations, and common JavaScript pitfalls.developers.google.com · read 4 Oct 2026
- Compilation modes
- Available compilation levels include WHITESPACE_ONLY, SIMPLE, and ADVANCED; the repository README also lists BUNDLE.github.com · read 4 Oct 2026
- Distribution
- The project page directs users to download a released JAR from Maven, and the repository README also documents Maven distribution.developers.google.com · read 4 Oct 2026
- File efficiency
- Google says the compiler reduces JavaScript file size and can help applications load faster while reducing bandwidth needs.developers.google.com · read 4 Oct 2026
- Help
- Google’s FAQ directs users to the Closure Compiler Discuss Group, Stack Overflow, and the FAQ itself for help.developers.google.com · read 4 Oct 2026
- Integrations
- The repository documents a NodeJS API and use through Maven, NPM, Bazel, and command-line Java.github.com · read 4 Oct 2026
- 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.github.com · read 4 Oct 2026
- 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.github.com · read 4 Oct 2026
- NPM package
- The repository README states that NPM packages are built and distributed by an open source contributor, not by Google.github.com · read 4 Oct 2026
- Purpose
- Closure Compiler optimizes JavaScript by analyzing it, removing dead code, rewriting and minimizing what remains, and checking syntax, references, and types.developers.google.com · read 4 Oct 2026
- 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.developers.google.com · read 4 Oct 2026
- Ways to use
- The project page describes an open source command-line Java application, a library used via Bazel, and an NPM package.developers.google.com · read 4 Oct 2026