- Home
- JavaScript Build Tools
- Terser
Terser
What it is
Terser is free, open-source software for reducing JavaScript size. It shortens variable names, removes whitespace and comments, and eliminates unused code. The toolkit works through a command-line interface or Node.js API, and browser loading exposes a global Terser variable with a minify property. The minify function enables compression and mangling by default, while both settings can be changed or disabled. The API can return source maps, and the command line can generate them for compressed JavaScript. Multiple input files are processed in sequence within one global scope; with no input filename, the CLI reads standard input. An ECMAScript compatibility setting is available and defaults to 5 for compression and output formatting. Property-name mangling can break code, and built-in DOM-property mangling is disabled by default. Stack Overflow is listed for community help, and the project accepts contributions.
For and against
For
- Free open-source JavaScript minifier
- Command-line and Node.js API access
- Browser global exposes minify
- Source map generation supported
- Compression and mangling are configurable
Against
- Property mangling can break code
- DOM property mangling is not recommended
- ECMAScript default target is 5
The verdict
Terser offers flexible JavaScript compression across command-line, Node.js, and browser use. Developers should handle property mangling carefully and set compatibility options deliberately.
Who it suits
Terser suits developers who need JavaScript minification from a command line, Node.js workflow, browser context, or API. It is especially relevant when source maps and configurable compression are needed.
Plans and prices
Terser
JavaScript minifier toolkit
Read 4 Oct 2026 · terser.org
On the record
- Browser use
- The API reference says browser loading is supported and exposes a global `Terser` variable with a `.minify` property.terser.org · read 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 · read 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 · read 4 Oct 2026
- Funding
- The site invites individual and organizational financial contributions to support the project.terser.org · read 4 Oct 2026
- Input stream
- If no input file is specified, the CLI reads from standard input.terser.org · read 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 · read 4 Oct 2026
- Multiple input files
- The CLI accepts multiple input files and parses them in sequence in the same global scope.terser.org · read 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 · read 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 · read 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 · read 4 Oct 2026
- Source maps
- The API can return a source map, and the CLI can generate source maps for compressed JavaScript.terser.org · read 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 · read 4 Oct 2026
- Ways to use
- The site says Terser can be used through its command-line interface or Node.js API.terser.org · read 4 Oct 2026