Skip to the content
Know your tech before you buy it. Makers: get listed from $49/mo

Google Closure Compiler

developers.google.com

  • Free plan
  • Windows
  • macOS
  • Linux
  • Self-hosted

What Google Closure Compiler is

Google Closure Compiler analyzes JavaScript, removes dead code, rewrites and minimizes what remains, and checks syntax, references, and types. Google says smaller output files can help applications load faster and reduce bandwidth needs. The compiler can also flag illegal JavaScript, potentially dangerous operations, and common pitfalls. Compilation options include WHITESPACE_ONLY, SIMPLE, and ADVANCED; the repository 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 library used through Bazel, and an NPM package. Released JAR files are distributed through Maven. The repository documents a NodeJS API and use through Maven, NPM, Bazel, and command-line Java; it says 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. Its input has restrictions, including goog.module() and goog.require(), and ES6 import/export support is not actively maintained. The tool is free at no cost.

Who it suits

It suits JavaScript developers who want code optimization and checks, including teams using Maven, Bazel, NPM, or command-line Java. Developers considering ADVANCED mode should be prepared to account for its aggressive transformations.

Good to know, and what to watch

  • Offers WHITESPACE_ONLY, SIMPLE, ADVANCED, and BUNDLE modes.
  • Checks syntax, references, types, and common pitfalls.
  • Available through command-line Java, Bazel, Maven, and NPM.
  • Supports code splitting, tree shaking, and source maps.
  • Free plan costs nothing.
  • 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.
  • ADVANCED transformations require care to preserve behavior.

Closure Compiler

Free

Free plan

Getting started

  1. Open the Closure Compiler project website
  2. Choose the command-line Java application, Bazel library, or NPM package
  3. Download a released JAR through Maven if using the Java distribution
  4. Install Java 21 or later, NodeJS, Git, and Bazelisk to build from the repository
  5. Select a compilation level such as WHITESPACE_ONLY, SIMPLE, ADVANCED, or BUNDLE

Limits to check

The tool has input restrictions, including goog.module() and goog.require(). ES6 import/export support is not actively maintained, and ADVANCED_OPTIMIZATIONS requires care to preserve behavior.

The verdict

Closure Compiler combines JavaScript optimization with code checks and several ways to integrate it into a build. Its input restrictions and the care needed with ADVANCED mode make compatibility worth checking before adoption.

Questions people ask

Is Google Closure Compiler free?

Yes. The listed Closure Compiler plan costs nothing and is free open-source software.

Which platforms are supported?

It is listed for Linux, macOS, Windows, and self-hosted use.

How can developers use it?

The project offers command-line Java, a Bazel library, an NPM package, Maven distribution, and a NodeJS API.

What help channels are available?

Google’s FAQ points users to the Closure Compiler Discuss Group, Stack Overflow, and the FAQ.

What the maker publishes

Advanced optimization
ADVANCED_OPTIMIZATIONS can improve compression through aggressive transformations and symbol renaming, and requires care to preserve program behavior. source
Build requirements
The repository README lists Java 21 or later, NodeJS, Git, and Bazelisk as requirements to build the compiler. source
Code checking
The compiler warns about illegal JavaScript, potentially dangerous operations, and common JavaScript pitfalls. source
Compilation modes
Available compilation levels include WHITESPACE_ONLY, SIMPLE, and ADVANCED; the repository README also lists BUNDLE. source
Distribution
The project page directs users to download a released JAR from Maven, and the repository README also documents Maven distribution. source
File efficiency
Google says the compiler reduces JavaScript file size and can help applications load faster while reducing bandwidth needs. source
Help
Google’s FAQ directs users to the Closure Compiler Discuss Group, Stack Overflow, and the FAQ itself for help. source
Integrations
The repository documents a NodeJS API and use through Maven, NPM, Bazel, and command-line Java. source
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. source
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. source
NPM package
The repository README states that NPM packages are built and distributed by an open source contributor, not by Google. source
Purpose
Closure Compiler optimizes JavaScript by analyzing it, removing dead code, rewriting and minimizing what remains, and checking syntax, references, and types. source
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. source
Ways to use
The project page describes an open source command-line Java application, a library used via Bazel, and an NPM package. source

Checked against the maker's pages on 4 Oct 2026.