Google Closure Compiler
Google Closure Compiler analyzes JavaScript to optimize it and check its correctness.
What Google Closure Compiler is
Google Closure Compiler analyzes JavaScript to optimize it and check its correctness. It removes dead code, rewrites and minimizes what remains, and checks syntax, references, and types. Google says smaller JavaScript files can help applications load faster and reduce bandwidth needs. It can also warn about illegal JavaScript, potentially dangerous operations, and common pitfalls. Compilation choices include WHITESPACE_ONLY, SIMPLE, and ADVANCED; the repository also lists BUNDLE. ADVANCED_OPTIMIZATIONS uses 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 available through Maven. Integrations include Maven, NPM, Bazel, command-line Java, and a NodeJS API. Building requires Java 21 or later, NodeJS, Git, and Bazelisk. Input restrictions include goog.module() and goog.require(); ES6 import/export support is not actively maintained.
Good
- Free and open source.
- Checks syntax, references, and types.
- Offers four documented compilation levels.
- Provides a NodeJS API and several distribution routes.
- Includes code splitting, tree shaking, and source maps.
Watch out
- Build requires Java 21 or later and other tools.
- ES6 import/export support is not actively maintained.
- Advanced optimization requires care to preserve behavior.
Who it suits
Closure Compiler suits JavaScript developers who want to reduce output size or check code through command-line, library, or NPM workflows. Its advanced mode is for users prepared to account for aggressive transformations.
Verdict
Google Closure Compiler combines JavaScript optimization with code checks and several ways to integrate it into a project. Review its input restrictions and build requirements before choosing it.
Plans and prices
From Google Closure Compiler's own pricing page, checked 4 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| Closure Compiler | Free | Open source Java application · Bazel library · NPM package |
The facts
Each one read from Google Closure Compiler's own pages, with the date it was checked.
What it does
- Advanced optimization
- ADVANCED_OPTIMIZATIONS can improve compression through aggressive transformations and symbol renaming, and requires care to preserve program behavior.checked 4 Oct 2026
- Build requirements
- The repository README lists Java 21 or later, NodeJS, Git, and Bazelisk as requirements to build the compiler.checked 4 Oct 2026
- Code checking
- The compiler warns about illegal JavaScript, potentially dangerous operations, and common JavaScript pitfalls.checked 4 Oct 2026
- Compilation modes
- Available compilation levels include WHITESPACE_ONLY, SIMPLE, and ADVANCED; the repository README also lists BUNDLE.checked 4 Oct 2026
- Distribution
- The project page directs users to download a released JAR from Maven, and the repository README also documents Maven distribution.checked 4 Oct 2026
- File efficiency
- Google says the compiler reduces JavaScript file size and can help applications load faster while reducing bandwidth needs.checked 4 Oct 2026
- Help
- Google’s FAQ directs users to the Closure Compiler Discuss Group, Stack Overflow, and the FAQ itself for help.checked 4 Oct 2026
- Integrations
- The repository documents a NodeJS API and use through Maven, NPM, Bazel, and command-line Java.checked 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.checked 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.checked 4 Oct 2026
- NPM package
- The repository README states that NPM packages are built and distributed by an open source contributor, not by Google.checked 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.checked 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.checked 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.checked 4 Oct 2026




