Freedom251 › JavaScript Build Tools
Terser

What Terser is
Terser is a free, open-source JavaScript minifier that reduces code size by shortening variable names, removing whitespace and comments, and dropping unused code. It is available for Linux, macOS, Windows, web, and API use. Developers can run it from the command line or use its Node.js API; browser loading exposes a global `Terser` variable with a `.minify` property. The API enables compression and mangling by default, though either can be configured or disabled. Terser can produce source maps, and the command-line interface can generate them for compressed JavaScript. The CLI accepts multiple input files and parses them in sequence in the same global scope, or reads from standard input when no input file is specified. Compatibility options include an ECMAScript target; the `ecma` setting defaults to 5 for compression and output formatting. Property-name mangling can break code, so the CLI documentation advises using it only when its behavior is understood. Built-in DOM property mangling is disabled by default and is not recommended for enabling.
Who it suits
Terser suits developers who need to minify JavaScript through a command-line tool, Node.js API, or browser loading. It also offers options for source maps and ECMAScript compatibility targets.
What it does well
- Free and open source
- Offers command-line and Node.js API use
- Can produce source maps
- Accepts multiple input files or standard input
- Compression and mangling can be configured or disabled
What to know first
- Property-name mangling can break code
- Built-in DOM property mangling is not recommended
Plans
| Plan | Billed and limits | Price |
|---|---|---|
| Terser | JavaScript minifier toolkit | Free |
As terser.org lists them, read 4 Oct 2026. The maker's own page has the final word.
Getting started
- Visit https://terser.org/.
- Use Terser through its command-line interface or Node.js API.
- For browser loading, use the exposed global `Terser` variable and its `.minify` property.
- Provide input files to the CLI, or omit a file to read from standard input.
Terser is a focused JavaScript minifier for developers who want command-line or Node.js control over production output. It fits individual developers and teams that need configurable compression and source maps without a subscription. Its main drawback is that aggressive property-name mangling can damage working code unless you understand the consequences.
Overview
Terser reduces JavaScript payloads by shortening variable names, removing whitespace and comments, and eliminating unused code. That makes it a practical last-mile optimization tool rather than a complete application build system. You can invoke it from a shell through the CLI or call it from Node.js, so it works in scripts, build pipelines, and custom tooling. Browser loading is also supported through a global Terser object with a .minify method.
Choose Terser when minification itself is the requirement and you want direct control over how it behaves. If you need a broader bundling or task-runner workflow, compare it with the tools in JavaScript Build Tools.
Key features
- CLI and Node.js API: Shell users can process files directly, while JavaScript applications can call the API programmatically. Browser loading extends that API to in-browser use, although it remains a minifier rather than a full browser build environment.
- Compression and mangling controls: The API turns both on by default, giving a conventional compact output with little initial configuration. Both modes can be configured or disabled, which is valuable when a project needs predictable transformations or a conservative compatibility posture.
- Source maps: The API can return a source map, and the CLI can create maps for compressed JavaScript. That preserves a route from minified output back to source during debugging and production diagnosis.
- Multiple-file and stream input: The CLI accepts several files and parses them in sequence within one global scope, useful when inputs are intended to share declarations. With no file argument, it reads standard input, fitting Unix pipelines and generated streams.
- ECMAScript compatibility: An ecma option targets ECMAScript versions and defaults to 5 for compression and output formatting. This default favors older syntax compatibility, while explicit targeting lets a project align output with its supported runtimes.
- Advanced integrations: Documentation describes accepting Acorn-produced SpiderMonkey AST input and using a Yarn resolution alias to replace nested uglify-es dependencies. Those paths matter mainly to toolchain maintainers rather than casual users.
- Property-name safeguards: Property mangling is available but can break code when names are accessed indirectly or expected externally. Built-in DOM property mangling is disabled by default and is not recommended to enable, so teams should treat property renaming as an opt-in optimization requiring careful review.
- Community support: Stack Overflow is offered as a community resource, and issue reports are expected to include a minimal reproducible example. This is a workable open-source support route, but it is not a dedicated support service.
Pricing
Terser is free and open source. The sole listed plan is Terser at free for the JavaScript minifier toolkit. There are no paid tiers, seat charges, usage quotas, or trial-to-renewal terms to weigh, making it suitable for personal projects and teams that want to run minification without licensing expenditure. The project invites individual and organizational contributions, but payment is not required to use the software.
Platforms
Terser is offered across API, Linux, macOS, web, and Windows. The API and CLI cover server, desktop, and automation environments; browser loading covers web contexts. The documented standard-input mode also suits platform-neutral pipeline use.
Who it's for
Terser is a strong choice for JavaScript developers who already have a build or deployment process and need a configurable minifier inside it. It suits teams that value source maps, multi-file CLI input, and explicit ECMAScript targeting, as well as open-source users who want no paid plan. It is less suitable as the sole answer for teams seeking bundling, task orchestration, or a visual workflow. Projects with extensive reflective property access should avoid casually enabling property-name mangling.
Pros and cons
Pros
- Free and open source: There is no subscription or paid tier blocking use in personal or commercial workflows.
- Flexible invocation: CLI, Node.js API, browser loading, standard input, and multi-file processing accommodate different automation designs.
- Useful output controls: Configurable compression, mangling, source maps, and ECMAScript targeting let teams trade size against compatibility and debuggability.
Cons
- Property mangling is risky: Renamed properties can break code, and even the documentation cautions users to enable the behavior only when they understand it.
- Focused scope: Terser provides minification capabilities, not a broader build-tool feature set on the strength of the documented functions.
- Community-led support: Help centers on Stack Overflow and reproducible issue reports rather than a dedicated support channel.
Alternatives
Pick Rolldown instead when you want a free, open-source tool available across Android, API, Linux, macOS, web, and Windows. esbuild is another free option, with native executable and WebAssembly forms and no paid tiers. Choose Rslib for a free MIT-licensed option associated with ByteDance Inc., or SWC for an open-source Rust-based developer toolchain. Rspack is free and MIT-licensed across Linux, macOS, self-hosted, web, and Windows. Vite offers a free, open-source MIT-licensed workflow for Linux, macOS, web, and Windows. Google Closure Compiler is a free open-source Java application, Bazel library, and NPM package. Grunt is a free open-source JavaScript task runner for Linux, macOS, and Windows.
Verdict
Choose Terser if you need a no-cost JavaScript minifier with both CLI and Node.js entry points, source-map support, and fine-grained compression and compatibility controls. Look elsewhere when your priority is an integrated build system or when your codebase cannot safely tolerate the risks of property-name mangling.
Verdict
Terser provides several ways to minify JavaScript and configure compression, mangling, and compatibility. Use property-name mangling cautiously because it can break code.
Questions
Is Terser free?
Yes. The listed Terser plan costs nothing, and the project is open source.
How can I use Terser?
It can be used through its command-line interface or Node.js API. Browser loading is also supported.
Can Terser create source maps?
Yes. The API can return a source map, and the CLI can generate source maps for compressed JavaScript.
What should I know about property mangling?
Property-name mangling can break code. Built-in DOM property mangling is disabled by default and is not recommended to enable.
What ECMAScript target does Terser use by default?
Its `ecma` setting defaults to 5 for compression and output formatting.
Where can users get community support?
The site links to Stack Overflow as a community resource.
Facts from Terser's own pages
- Browser use
- The API reference says browser loading is supported and exposes a global `Terser` variable with a `.minify` property. · terser.org, 4 Oct 2026
- Compatibility options
- Terser provides options for ECMAScript targets, including an `ecma` setting that defaults to 5 for compression and output formatting. · terser.org, 4 Oct 2026
- Compression and mangling
- The API's `minify()` enables compression and mangling by default, and both can be configured or disabled. · terser.org, 4 Oct 2026
- Funding
- The site invites individual and organizational financial contributions to support the project. · terser.org, 4 Oct 2026
- Input stream
- If no input file is specified, the CLI reads from standard input. · terser.org, 4 Oct 2026
- Integrations
- The project documentation describes using Terser with Acorn-produced SpiderMonkey AST input and replacing nested `uglify-es` dependencies with a Yarn resolution alias. · terser.org, 4 Oct 2026
- Multiple input files
- The CLI accepts multiple input files and parses them in sequence in the same global scope. · terser.org, 4 Oct 2026
- Property mangling risk
- The CLI documentation warns that property-name mangling can break code and advises using it only when its behavior is understood. · terser.org, 4 Oct 2026
- Property mangling safeguards
- The options documentation says built-in DOM property mangling is disabled by default and is not recommended to enable. · terser.org, 4 Oct 2026
- Purpose
- Terser is an industry-standard JavaScript minifier that shrinks variable names, removes whitespace and comments, and drops unused code. · terser.org, 4 Oct 2026
- Source maps
- The API can return a source map, and the CLI can generate source maps for compressed JavaScript. · terser.org, 4 Oct 2026
- Support
- The site links to Stack Overflow as a community resource, and its issue-reporting guide asks users to provide a minimal reproducible example. · terser.org, 4 Oct 2026
- Ways to use
- The site says Terser can be used through its command-line interface or Node.js API. · terser.org, 4 Oct 2026
Where Terser stands on Freedom251
- JavaScript Build Tools#11 of 27