Terser
terser.org
- Free plan
- Windows
- macOS
- Linux
- Web
- API
What Terser is
Terser is an open-source JavaScript minifier that reduces code by shortening variable names, removing whitespace and comments, and dropping unused code. It is free and can be used from its command-line interface or Node.js API; browser loading is also supported and makes a global `Terser` variable with a `.minify` property available. The API's `minify()` turns on compression and mangling by default, and users can configure or disable either. The API can return a source map, while the CLI can generate maps for compressed JavaScript. The CLI accepts multiple input files, parsing them in sequence in the same global scope, and reads from standard input if no input file is named. Compatibility options include an ECMAScript target; `ecma` defaults to 5 for compression and output formatting. Property-name mangling can break code, so the project advises using it only when its behavior is understood. Built-in DOM property mangling is disabled by default and is not recommended for activation. Project resources include Stack Overflow and guidance to submit a minimal reproducible example with issue reports.
Who it suits
Terser suits developers who need to minify JavaScript through a command line, Node.js API or browser loading. Its configurable compression, mangling and source-map options may be useful to teams with specific build requirements.
Good to know, and what to watch
- Free, open-source JavaScript minification.
- CLI and Node.js API usage are supported.
- Compression and mangling can be configured or disabled.
- Can produce source maps.
- CLI accepts multiple files or standard input.
- Property-name mangling can break code.
- Built-in DOM property mangling is not recommended.
Plans
Every plan and priceTerser
Open source
Getting started
- Open the Terser website
- Install or access Terser for your platform
- Use the command-line interface or Node.js API
- Load it in a browser when needed
- Provide JavaScript files or standard input
- Configure compression, mangling, source maps, or ECMAScript targets
Limits to check
Terser is free and open source. Property-name mangling may break code, and built-in DOM property mangling is disabled by default and not recommended to enable.
The verdict
Terser offers several ways to minify JavaScript, with controls for compression, mangling and compatibility. Take care with property-name mangling, which can break code if used without understanding its effects.
Questions people ask
How much does Terser cost?
Terser is free open-source software, listed as free.
How can I use Terser?
You can use its command-line interface, Node.js API, or browser loading with the global Terser variable.
Does Terser create source maps?
Yes. The API can return a source map, and the CLI can generate source maps for compressed JavaScript.
What happens when no CLI input file is supplied?
The command-line interface reads JavaScript from standard input.
What platforms does Terser support?
Terser supports Linux, macOS, Windows, web, and API use.
Is property mangling safe by default?
Property-name mangling can break code. Built-in DOM property mangling is disabled by default and is not recommended to enable.
What the maker publishes
- Browser use
- The API reference says browser loading is supported and exposes a global `Terser` variable with a `.minify` property. source
- Compatibility options
- Terser provides options for ECMAScript targets, including an `ecma` setting that defaults to 5 for compression and output formatting. source
- Compression and mangling
- The API's `minify()` enables compression and mangling by default, and both can be configured or disabled. source
- Funding
- The site invites individual and organizational financial contributions to support the project. source
- Input stream
- If no input file is specified, the CLI reads from standard input. source
- Integrations
- The project documentation describes using Terser with Acorn-produced SpiderMonkey AST input and replacing nested `uglify-es` dependencies with a Yarn resolution alias. source
- Multiple input files
- The CLI accepts multiple input files and parses them in sequence in the same global scope. source
- Property mangling risk
- The CLI documentation warns that property-name mangling can break code and advises using it only when its behavior is understood. source
- Property mangling safeguards
- The options documentation says built-in DOM property mangling is disabled by default and is not recommended to enable. source
- Purpose
- Terser is an industry-standard JavaScript minifier that shrinks variable names, removes whitespace and comments, and drops unused code. source
- Source maps
- The API can return a source map, and the CLI can generate source maps for compressed JavaScript. source
- Support
- The site links to Stack Overflow as a community resource, and its issue-reporting guide asks users to provide a minimal reproducible example. source
- Ways to use
- The site says Terser can be used through its command-line interface or Node.js API. source
Checked against the maker's pages on 4 Oct 2026.