Language
English English Vietnamese (Tiếng Việt) Vietnamese (Tiếng Việt) Chinese (简体中文) Chinese (简体中文) Portuguese (Brazil) (Português do Brasil) Portuguese (Brazil) (Português do Brasil) Spanish (Español) Spanish (Español) Indonesian (Bahasa Indonesia) Indonesian (Bahasa Indonesia)
JavaScript Minifier

JavaScript Minifier

Minify JavaScript in your browser with Terser to shrink file size, with mangle, compress, drop console and drop debugger options plus live compression stats.

Minify JavaScript to Shrink File Size

This JavaScript minifier compresses your JS in the browser to reduce file size and speed up page loads. Powered by Terser, the industry-standard ES6+ minifier, it strips whitespace and comments, shortens local variable names, removes dead code, and drops debug statements to produce lean, production-ready output.

Runs entirely in your browser. Terser executes locally, so your JavaScript is never uploaded or stored — even proprietary source stays on your machine.

Why Minify JavaScript

Faster Load & Parse

Smaller scripts download quicker and the engine parses fewer characters, cutting the time to interactivity.

Smaller Payload

Mangling and compression commonly shave a large share off source size before gzip even applies.

Cleaner Production Code

Drop console logs and debugger statements so debug output never leaks to end users.

How to Minify JS Code

1

Paste or Upload Your JS

Type or paste your script into the input panel, or use Upload to load a .js file. Press Sample to drop in example code.

2

Configure Terser Options

Toggle Mangle, Compress, Drop console, and Drop debugger to tune how aggressively the code is optimized.

3

Minify

Output updates automatically as you type (debounced). To run it now, press Ctrl + Enter and the result appears instantly in the output panel.

4

Review & Export

Check the stats bar for original size, minified size, and percent saved. Then Copy the output or Download it as minified.js.

Shortcut: press Ctrl + Enter in the editor to minify on the spot; Tab inserts 4 spaces.

Terser Optimizations & Features

Minification Options Explained

Each toggle maps to a Terser transformation. Comments are always stripped from the output regardless of the toggles below.

OptionWhat It DoesDefault
MangleShortens local variable and function names (e.g. userNamea)On
CompressApplies dead-code elimination and many size optimizationsOn
Drop consoleRemoves all console.* callsOff
Drop debuggerRemoves debugger statementsOn

Production-Grade Engine

Full ES6+ Support

Terser understands arrow functions, classes, template literals, async/await, and other modern syntax.

Debug Cleanup

Strip console output and debugger breakpoints so they never ship to production.

Live Compression Stats

See original size, minified size, and percent saved after every run, plus syntax-highlighted output.

Upload, Copy & Download

Load a .js file or paste code, then copy the result or download it as minified.js.

Mangle caution: Terser renames only local identifiers, never globals or object properties accessed by string. Avoid relying on function or variable names at runtime (for example, framework reflection) when mangling is on.

Frequently Asked Questions

Is my code sent to a server?

No. Terser runs locally in your browser. Your JavaScript is never uploaded, logged, or stored anywhere.

Does minifying JavaScript improve page speed?

Yes. Removing whitespace, comments, and long identifier names shrinks the file so it downloads and parses faster. The stats bar shows exactly how many bytes you save on each run. Minification pairs well with gzip/Brotli compression on the server.

What does "Mangle" do?

Mangling shortens local variable and function names — for example myVariable becomes a — to cut file size without changing how the code behaves. It only renames identifiers that are not exposed externally.

Should I enable "Drop console" for production?

Usually, yes. Removing console.* calls reduces file size and prevents debug information from leaking to users. Keep it off if your app intentionally logs to the console in production.

Can I unminify or reverse the output?

Minification is one-way. You can re-indent minified code with a formatter to make it readable again, but mangled variable names and removed comments cannot be restored — always keep your original source.

What minification engine is used?

This tool uses Terser (version 5.46.0), the most widely adopted JavaScript minifier and the same engine behind many modern bundlers. It fully supports ES6+ syntax.

Can minification break my code?

Terser is highly reliable, but aggressive mangling can affect code that depends on identifier names at runtime (such as some reflection or serialization tricks). Always test the minified output before deploying, and keep your original source.

Input
Output
Error

Paste code on the left to minify automatically

Original 0 B Minified 0 B
Saved 0%
|
Paste or upload your JavaScript, then press Minify or Ctrl+Enter to compress it.
Keep Mangle and Compress on for the smallest output.
Enable Drop console to strip every console.* call before shipping to production.
Terser runs locally — your code never leaves your browser.
Want to learn more? Read documentation →
1/5
Start typing to search...
Searching...
No results found
Try searching with different keywords