terser.org
At a glance
- Category
- Development
- Language
- English
- Paid-content signal
- No paid content foundObserved
- Registered
- 2019
- Hosting
- FastlyInferred
- HTTPS certificate trusted
- PassedObserved
- Last updated
Related questions
More questions →What options does Terser provide for mangling and compression?
Terser exposes two main option groups that control how it shrinks JavaScript: mangle options (rename variables, functions, and properties) and compress options (remove dead code, fold constants, simplify expressions). You pass them as a plain object to the Node.js API or as flags to the CLI. The defaults are already aggressive enough for most production builds, so the practical work is usually knowing which options to turn off when something breaks.
Terser describes itself as an "industry-standard minifier for JavaScript code" that "shrinks variable names, removes whitespace and comments, and drops unused code," usable "through the Command line or Node.JS API." Everything below maps to that mangle/compress split.
Mangle options
Mangling is the step that shortens identifiers. It runs after compression and is the main reason minified output is unreadable.
| Option | Type | What it does |
|---|---|---|
mangle |
boolean or object | Master switch. false disables all renaming; an object configures the sub-options below. |
toplevel |
boolean | Also mangle top-level names. Off by default because it can break code that relies on globals. |
eval |
boolean | Mangle names referenced inside eval or with. Off by default. |
keep_classnames |
boolean | Preserve class names instead of renaming them. |
keep_fnames |
boolean | Preserve function names. Useful when code inspects fn.name or uses it in stack traces. |
reserved |
string[] | A list of names Terser must never rename. |
properties |
object | Enable property mangling. This is opt-in and the riskiest mangle feature — see the warning below. |
Property mangling is the one to be careful with
By default Terser does not rename object properties, because property names are part of the public shape of your objects and are frequently accessed as strings. Turning on mangle.properties renames them, which breaks any code that reads a property by a computed or external string — for example obj["userName"], JSON payloads, or DOM/API contracts. If you enable it, use properties.reserved or properties.regex to protect the names that must stay stable.
Compress options
Compression is where most of the size reduction comes from. It is a large set of boolean passes, each toggling one optimization. The most consequential ones:
drop_console— removesconsole.*calls. Handy for production, but it also strips logging you may want in staging.drop_debugger— removesdebuggerstatements.dead_code— removes unreachable code.unused— drops unused variables and functions.evaluate— evaluates constant expressions at build time.conditionals— optimizesif/ternary branches.sequences— joins consecutive statements with the comma operator.booleans— simplifies boolean contexts.passes— a number, not a boolean: how many times to run the compress passes. More passes can shrink further at the cost of build time.pure_funcs— an array of function names you declare side-effect-free, so calls to them can be dropped when their result is unused.pure_getters— tells Terser that property access has no side effects, enabling more removal.
You can also disable a pass by setting it to false, which is the usual fix when an optimization changes behavior you depend on.
How to pass options
Node.js API
const { minify } = require("terser");
const code = `function add(a, b) { return a + b; } console.log(add(1, 2));`;
const result = await minify(code, {
compress: {
drop_console: true,
passes: 2
},
mangle: {
toplevel: true,
keep_fnames: false
}
});
console.log(result.code);
The first argument is the source (a string or an object mapping filenames to sources), the second is the options object. The resolved output is on result.code.
CLI
The CLI accepts the same options as flags. A typical invocation:
terser input.js -c drop_console=true,passes=2 -m toplevel=true -o output.js
-c(or--compress) takes the compress options.-m(or--mangle) takes the mangle options.-owrites to a file instead of stdout.
For anything beyond a couple of flags, a config file is easier to maintain than a long command line, and it keeps the same option names you would use in the API.
Practical guidance
- Start with defaults. Terser's defaults already mangle and compress; only add options when you have a specific goal (smaller output, no console logs, preserved names).
- Reach for
keep_fnames/keep_classnamesfirst when something breaks. Name-dependent code (reflection, stack traces, some frameworks) is the most common failure mode. - Treat
mangle.propertiesas a separate project. It needs a reserved list and thorough testing before it goes anywhere near production. - Increase
passesonly if you measure a gain. It multiplies build time, and the returns diminish quickly. - Verify by running the minified bundle, not just by reading it. Compression can change behavior in edge cases, so your test suite is the real check.
The full option list lives in the Terser API and CLI documentation, and the project's REPL lets you paste code and toggle options to see the effect immediately — the fastest way to confirm what a given option actually does to your output.
How Does Terser Compare to Other JavaScript Minifiers?
Terser is a JavaScript mangler and compressor toolkit that shrinks variable names, removes whitespace and comments, and drops unused code. It is positioned as an industry-standard minifier and can be used through either a command line interface or a Node.js API. If you need to minify modern JavaScript, Terser is a strong default choice — but whether it beats alternatives depends on your build setup, syntax targets, and how much control you want over the output.
What Terser actually does
Terser performs three main jobs:
- Mangling — renames variables and functions to shorter identifiers.
- Compression — removes whitespace, comments, and other unnecessary characters.
- Dead code elimination — drops code that is never reached or used.
These are the core operations most JavaScript minifiers share. The differences between tools usually come down to syntax support, output quality, and integration.
Terser vs. UglifyJS
Terser is widely understood as a fork of UglifyJS created to support modern JavaScript. That relationship shapes the comparison:
| Dimension | Terser | UglifyJS |
|---|---|---|
| Modern syntax (ES6+) | Built to handle it | Historically limited |
| Role in ecosystem | Industry-standard minifier | Older, largely superseded |
| Interface | CLI and Node.js API | CLI and API |
| Core operations | Mangle, compress, drop unused code | Mangle, compress |
The practical takeaway: if your code uses ES6+ syntax, Terser is generally the safer pick because it was designed with that syntax in mind. UglifyJS predates much of that syntax and has not been the default choice for modern toolchains.
Why Terser is often the default
Terser's own site describes it as an industry-standard minifier, and its adoption reflects that. Several factors explain why it shows up in so many build pipelines:
- Modern syntax support — it handles the JavaScript people actually write today.
- Two integration paths — a CLI for scripts and one-off runs, and a Node.js API for build tools.
- Ecosystem gravity — many bundlers and frameworks rely on it, so it is often already in your dependency tree.
If you are choosing a minifier for a new project, these points usually make Terser the path of least resistance.
When another tool might fit better
Terser is not automatically the right answer in every case:
- You need the smallest possible output and are willing to trade build time. Some tools or configurations prioritize maximum compression differently.
- You are locked into a legacy pipeline. If your existing setup depends on UglifyJS-specific behavior, migrating has a cost.
- You want a specific integration. Some bundlers expose their own minifier configuration, and the "choice" is really about which plugin you enable.
The honest framing: Terser is the common default, but "default" and "best for your case" are not the same thing.
How to decide
Ask three questions:
- Does your code use ES6+ syntax? If yes, lean toward Terser.
- How do you want to run it? Terser offers both a CLI and a Node.js API, so it fits scripted and programmatic workflows.
- Is it already in your toolchain? If a bundler already pulls it in, using it directly avoids adding another dependency.
If you answered "yes," "either," and "yes," Terser is the straightforward choice. If you have a legacy pipeline or a hard constraint on output size, compare against what you are already using before switching.
For usage details, Terser publishes CLI docs, an API reference, and an options list, plus a REPL for trying transformations interactively.
Who Uses Terser?
Terser is an industry-standard minifier for JavaScript, and its own site describes it as such. The homepage includes a "Who is Using Terser?" section, which signals that adoption by known projects is part of how the project presents itself. However, the page evidence available here does not list specific company or project names, so any claim about a particular organization using Terser would go beyond what the source supports. What can be confirmed from the site is the shape of its community: code contributors, individual financial contributors, and organization financial contributors.
What the Terser site confirms about its users and community
The homepage headings include:
- "Who is Using Terser?"
- "Code Contributors"
- "Individual Financial Contributors"
- "Organization Financial Contributors"
The excerpt also states: "This project exists thanks to all the people who contribute." and invites organizations to "Support this project with your organization. Your logo will show up here with a link to your website."
So the site distinguishes between:
| Group | What the site says |
|---|---|
| Users | A "Who is Using Terser?" section exists, but no named users appear in the provided evidence |
| Code contributors | The project exists thanks to contributors; there is a Contribute link |
| Individual financial contributors | You can become a financial contributor to help sustain the community |
| Organization financial contributors | Organizations can support the project and have their logo shown with a link |
How to judge Terser's adoption without a user list
If you are evaluating Terser for reliability or community adoption, the absence of a named user list in this evidence does not mean there are no users. It means the specific names are not available here. You can still assess adoption through verifiable signals:
- Ecosystem role: The site calls Terser an "industry-standard minifier for JavaScript code." That is the project's own framing, not an independent audit.
- Integration surface: Terser is usable through the Command line or Node.js API, which makes it embeddable in build pipelines and tooling.
- Community channels: The site links to Docs, CLI Usage, API Reference, Stack Overflow, and GitHub. These are places where real usage questions and answers accumulate.
- Contribution activity: Code Contributors and financial contributor sections indicate an active maintenance and funding structure.
For a concrete check, look at whether the build tools you already use expose Terser options or depend on it. That is a more reliable adoption signal for your own stack than a logo wall.
How to contribute or support Terser
The site provides direct paths:
- Contribute code — Use the "Contribute" link in the Code Contributors section.
- Become an individual financial contributor — Use the "Contribute" link in the Individual Financial Contributors section.
- Support as an organization — Use the "Contribute" link in the Organization Financial Contributors section. The site states your logo will show up with a link to your website.
The homepage also has a Donate link in the navigation.
What this means for your decision
If your question is "do real projects use Terser?", the site's own "Who is Using Terser?" section and its "industry-standard" description are directional evidence, but the specific names are not in the provided page evidence. To make a decision, verify adoption in your own dependency graph: check whether your bundler, framework, or CLI tooling already invokes Terser or exposes its options. That tells you whether Terser is already part of your build path, which matters more than a logo list.
If your question is "how do I get involved?", the site gives you three concrete routes: code contribution, individual funding, and organizational funding with logo placement.
How to Use Terser via CLI or Node.js API
Terser is a JavaScript mangler and compressor toolkit that shrinks variable names, removes whitespace and comments, and drops unused code. You can run it two ways: through the Command line for one-off files and build scripts, or through the Node.JS API when you need to minify code programmatically inside a tool or pipeline. Both paths expose the same core options, so the choice comes down to whether you want a shell command or a JavaScript function call.
Using the Terser CLI
The CLI is the fastest route for minifying a file or a directory of files.
Basic usage
terser input.js -o output.js
- Input: the source file you pass as the first argument.
- Action: Terser parses the file, applies mangling and compression, and writes the result.
- Expected result:
output.jscontains the minified code. If you omit-o, the result is printed to standard output.
Common options
| Option | What it does |
|---|---|
-c / --compress |
Enables the compressor (drops unused code, simplifies expressions). |
-m / --mangle |
Shortens variable and function names. |
-o / --output |
Writes the result to a file instead of stdout. |
--source-map |
Emits a source map alongside the output. |
A typical production command combines them:
terser input.js -c -m -o output.min.js --source-map "url='output.min.js.map'"
Verifying the result
After running, open output.min.js and confirm that whitespace and comments are gone and identifiers are shortened. If the file still looks unminified, the compressor or mangler flag was likely omitted.
Common snags
- Broken code after mangling: mangling renames identifiers, so code that relies on
Function.prototype.nameor string-based lookups can break. Disable mangling for those cases or exclude specific names. - No output file: if you forget
-o, the minified code goes to stdout and may scroll past in the terminal.
Using the Terser Node.js API
The API is the right choice when minification is part of a larger JavaScript program — a custom build step, a bundler plugin, or a server-side transform.
Basic usage
const { minify } = require("terser");
const code = `function add(first, second) { return first + second; }`;
minify(code, {
compress: true,
mangle: true,
}).then((result) => {
console.log(result.code);
});
- Input: the source string as the first argument, and an options object as the second.
- Action:
minifyreturns a promise that resolves to an object. - Expected result:
result.codeholds the minified string. If minification fails,result.erroris set instead.
Configuring compress and mangle
Both compress and mangle accept either a boolean or an options object for finer control:
minify(code, {
compress: {
drop_console: true,
passes: 2,
},
mangle: {
toplevel: true,
},
});
compresscontrols code-level optimizations such as removing unused statements.manglecontrols identifier renaming;toplevel: trueextends renaming to top-level names.
Handling the result
Always check for errors before using the output:
const result = await minify(code, { compress: true, mangle: true });
if (result.error) {
throw result.error;
}
console.log(result.code);
Where to Find Full Documentation
Terser publishes dedicated references for both interfaces:
- CLI Docs — every command-line flag and its behavior.
- API Reference — the full options object for
minifyand related functions. - Options — the shared list of compress and mangle settings.
- REPL — a browser playground for testing options against sample code before wiring them into a build.
The project also maintains a GitHub repository and a Stack Overflow community tag for questions. Because Terser is described as an industry-standard minifier, its options surface is broad; the REPL is the quickest way to confirm what a given flag does to your code before committing it to a build script.
What is Terser?
Terser is an industry-standard minifier for JavaScript. It shrinks variable names, removes whitespace and comments, and drops unused code. You can use it through the command line or the Node.js API. If you need to reduce the size of JavaScript you ship to the browser or run in Node.js, Terser is the tool this site documents.
What Terser actually does
Terser is described on terser.org as a "JavaScript mangler and compressor toolkit." Those two words map to two distinct jobs:
- Mangling — shortening variable and function names (for example, turning a descriptive identifier into a single character) so the code takes fewer bytes without changing behavior.
- Compressing — removing whitespace and comments, and dropping code that is never used.
The result is smaller JavaScript that behaves the same as the original, which is why it is called a minifier rather than a formatter or a bundler.
How you use it
Terser exposes two entry points, both listed on the site:
| Interface | What it is for |
|---|---|
| Command line | Running Terser as a CLI tool over files or input |
| Node.js API | Calling Terser programmatically from JavaScript build code |
The site links to dedicated CLI Usage and API Reference documentation for each. If you are wiring minification into a build pipeline, the Node.js API is the programmatic route; if you just want to minify a file or a stream, the CLI is the direct one.
Why it matters
Terser is not a niche utility — the site states it is an "industry-standard minifier for JavaScript code." That status comes from being the minifier that many build tools and projects rely on to cut payload size. Smaller JavaScript means less to download, parse, and execute, which is the practical reason minification sits in most production build steps.
Where to go next
- Docs — API Docs, CLI Docs, and an Options reference for configuring behavior.
- REPL — an interactive environment to try Terser on code directly.
- GitHub — source, issues, and contribution entry points.
- Community — a Stack Overflow link and a blog for questions and write-ups.
Terser is also sustained by contributors: the site lists code contributors plus individual and organization financial contributors, with a Contribute link for each.
Website Overview
Identifiable technologies and additional version or configuration signals make the service easier to fingerprint, which may help targeted scanners narrow their checks. An established domain and managed infrastructure suggest continuity of operations and may support dependable delivery, although neither guarantees service quality.
Domain and Registration
Registered in 2019, this domain has about 7 years of history. That suggests continuity, although ownership and purpose may have changed. The domain uses the common .org extension, which is not an independent safety signal.
DNS and Email
Nameservers are provided by Amazon Route 53, indicating managed DNS hosting. No CNAME was found; the observed records resolve directly to addresses. No MX record was found. A conventional explicit inbound-mail route is not configured. TXT records include verification markers for Google. Such markers may also remain after a service stops being used. DNSSEC signatures were not detected, so this additional DNS authenticity protection is not confirmed.
TLS and Certificates
The certificate uses an RSA 2048-bit public key, offering broad client compatibility. The server supplied a complete certificate chain. No organization name is present in the certificate; the available fields are consistent with domain validation. The certificate was issued by Let's Encrypt, commonly associated with automated certificate services. The certificate's total validity is about 89 days, consistent with a short renewal cycle.
HTTP and Browser Security
The response lacks these common security headers: CSP, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, clickjacking protection. CORS permits any origin to read this response. This is common for public resources; sensitive responses need narrower handling. No X-Powered-By header was found, reducing one common source of backend fingerprinting information. The x-cache, x-served-by, via response header indicates a CDN or caching proxy in the delivery path. No obvious internal addresses or debug information were found in the headers.
Technology Stack Analysis
The public page identifies Docusaurus 3.1.0, Fastly, with exact versions exposed for 1 technologies. These details can narrow vulnerability checks, although exposure alone is not a vulnerability.
Search and Social Sharing
No homepage meta description was detected, leaving snippet selection more dependent on page text. The Generator tag identifies Docusaurus v3.1.0, making the publishing system easier to fingerprint. Open Graph is partially configured; og:description, og:type is missing. Twitter Card metadata is configured. The page declares 2 language or regional alternatives using hreflang.
Hosting and Email
Registration details
| Registrar | Amazon Registrar, Inc. |
|---|---|
| Registered | 2019-02-06 |
| Expires | 2027-02-06 |
| Domain status | active |
| Nameservers | ns-1171.awsdns-18.org、ns-170.awsdns-21.com、ns-1743.awsdns-25.co.uk、ns-957.awsdns-55.net |
| DNSSEC | unsigned |
DNS records
| Type | Name | Value | TTL | Priority |
|---|---|---|---|---|
| A | terser.org | 185.199.108.153 | 3600 | — |
| A | terser.org | 185.199.109.153 | 3600 | — |
| A | terser.org | 185.199.110.153 | 3600 | — |
| A | terser.org | 185.199.111.153 | 3600 | — |
| NS | terser.org | ns-1171.awsdns-18.org | 172800 | — |
| NS | terser.org | ns-170.awsdns-21.com | 172800 | — |
| NS | terser.org | ns-1743.awsdns-25.co.uk | 172800 | — |
| NS | terser.org | ns-957.awsdns-55.net | 172800 | — |
| TXT | terser.org | google-site-verification=rgtrmPcpCVu6UBbqWx-P2CfucOl3cxCdZwbU2v8TJWQ | 300 | — |
TLS and certificates
HTTP response headers
| Header | Value |
|---|---|
| content-type | text/html; charset=utf-8 |
| cache-control | max-age=600 |
| server | GitHub.com |
| strict-transport-security | max-age=31556952 |
| access-control-allow-origin | * |
Identified technologies
Pages, Search and Sharing
| Meta description | Not detected |
|---|---|
| Canonical URL | https://terser.org/ |
| Language | English (default) |
| Twitter Card | summary_large_image |
Social Sharing Preview
6 fieldsrobots.txt (opens in a new tab)
HTTP 404No robots.txt found
Sitemaps
1Recent Updates
- Website images
- Screenshots
- Network details
- Website Technologies
- Pages and Search Information
- TLS and certificates
- DNS Information
- Domain Registration
- HTTP Response Information
- Website profile
- Website Name
- Website profile
- Website Description
- Website Name
User reviews (0)