home / tools / js minifier

JavaScript Minifier.

Paste code, upload a .js file, or fetch a URL. Variables get mangled, comments stripped, whitespace squeezed. Minification runs in your browser using Terser, the same engine Webpack and Rollup use.

// minification powered by Terser v5.36.0 · BSD-2-Clause license · original work by Fábio Santos and contributors
// how it works & attribution

Minification is handled by Terser, the JavaScript mangler/compressor used by Webpack, Rollup, Parcel, and most modern bundlers. The library is loaded once from a public CDN (cdn.jsdelivr.net/npm/terser@5.36.0), then your code is minified entirely in this browser tab. Nothing is sent to any server.

Mangle renames local variables to single letters (userName → n). Big wins, but breaks any code that relies on names existing at runtime (some legacy DI containers, certain angular.js patterns). Turn it off if you hit issues.

Compress performs dead-code elimination, constant folding, boolean simplification, and other AST rewrites. Safe for nearly all code; rare issues come up with code that depends on Function.prototype.toString() or live-edited source.

URL fetch limitations: browsers block cross-origin requests by default. The "Fetch" button only works for URLs served with permissive CORS headers (most public CDNs, including jsdelivr, unpkg, and cdnjs, allow this; most private hosts don't). If a fetch fails, paste the code instead or download the file and use Upload.

Privacy: your code never leaves your browser. Verify in the Network tab: you'll see the Terser library download once on first use, and nothing else.

Attribution: this tool is a thin wrapper around Terser (BSD-2-Clause). Terser is a fork of UglifyJS3, originally by Mihai Bazon. All minification credit belongs to the Terser maintainers.

Related: need to minify stylesheets? The CSS Minifier does the same browser-local treatment for CSS. Working with JSON instead of JavaScript? The JSON Formatter & Validator handles JSON payloads.

// a free, browser-only tool by Tiempo Software, built in Omaha, Nebraska. Runs entirely in your browser; nothing you enter is uploaded. see all tools.