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 code online to reduce file size. Supports mangle, compress, drop console, and drop debugger options.

JavaScript Minifier

The JavaScript Minifier is a free online tool that compresses JS code to reduce file size. Powered by Terser, the industry-standard ES6+ minifier, it removes whitespace, shortens variable names, eliminates dead code, and strips 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 bundles download quicker and the engine parses fewer characters, speeding up page interactivity.

Smaller Bundles

Mangling and compression often cut 40–70% off source size before gzip even kicks in.

Cleaner Production Code

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

How to Minify JavaScript

1

Paste or Upload Your JS

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

2

Configure Terser Options

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

3

Minify

Click Minify or press Ctrl + Enter. Terser processes the code and the result appears instantly in the output panel.

4

Review & Export

Check the stats bar for original size, minified size, and savings. Then Copy the output or Download it as a file.

Shortcut: press Ctrl + Enter in the editor to minify on the spot.

Optimizations & Features

Terser Options Explained

Each option maps to a Terser transformation. Together they handle modern ES6+ syntax and produce reliable production output.

OptionWhat It DoesDefault
MangleShortens local variable and function names (e.g. userNamea)On
CompressApplies dead-code elimination and dozens of 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.

Compression Stats

See original size, minified size, and the percentage saved after every run.

Upload or Paste

Load a .js file from disk or paste code directly — whichever suits you.

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.

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.log 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.

What minification engine is used?

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

Can it 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 your JavaScript code and click Minify to compress it.
Use Ctrl+Enter to minify quickly.
Enable Drop console to remove all console.log statements for production.
Want to learn more? Read documentation →
1/4
Can't find it? Build your own tool with AI
Start typing to search...
Searching...
No results found
Try searching with different keywords