Need a script smaller for production — a snippet for a CMS field, a tag manager, or a bookmarklet? This free js minifier rewrites your JavaScript with a real minifier engine: comments and whitespace go, local names shrink, and dead code drops out. Everything runs in your browser, so nothing is uploaded, no account is needed, and no signup stands between you and the result.

How to use this js minifier

Three quick steps — no signup, no cost.

1Paste your JavaScript

A function, a snippet, or a whole file. Modern syntax — classes, async functions, modules — is handled by the engine, not by string tricks.

2Set the options

Keep mangling on for the smallest output, or turn it off when names matter; optionally drop console calls and keep licence comments.

3Minify and test the result

Check the before-and-after sizes, copy or download the output, and run your tests against the minified version before it ships.

Why this js minifier uses a real engine instead of deleting spaces

Smaller output that still means the same thing.

True minification, not text stripping

The code is parsed into a syntax tree, so dead branches and unused code can be removed safely instead of merely hiding whitespace.

Name mangling that respects boundaries

Local variables and parameters shrink to short names, while globals, exports, and property names are left alone so other scripts keep working.

Options for real projects

Drop console calls for production, keep /*! licence comments by default, and choose the ECMAScript level you ship to.

Errors that point at your code

A syntax error surfaces with the engine’s message before any transformation runs, so you fix the actual problem instead of debugging broken output.

When minified code behaves differently — and how to prevent it

Minification is designed to preserve behaviour, but a handful of patterns depend on the very things it removes.

Code that reads its own names. If anything relies on function.name, class names, or eval, mangling can change what it sees. Switch mangling off, or keep names, for those files.

Dropped console calls. Removing console.log is safe for output, but not if your code overrides console methods or another script reads them. Leave the drop-console option off unless you are sure.

Top-level names shared with other scripts. Mangling top-level names can break scripts that expect a global to exist. Keep top-level mangling off when the file shares globals with other code on the page.

Modules and old browsers. Files using import or export need module mode, and code targeting old browsers needs an older ECMAScript level. Pick the setting that matches where the file will run, then test the minified output — never ship it untested.

JS Minifier FAQs

Short, direct answers to the questions readers ask most.

It rewrites JavaScript into the smallest form that behaves the same: comments and whitespace are removed, local names are shortened, and unreachable or unused code is dropped.

Usually yes, because the engine only makes meaning-preserving changes. The exceptions are code that relies on function names, uses eval, or reads its own source — test the output before deploying.

It renames local variables and parameters to short names such as a and b, which saves bytes. Names visible from outside, such as properties and top-level globals, are left alone.

The engine parses your code first, so the error is almost always a syntax problem in the input, such as a missing bracket. Fix the reported problem and minify again.

Yes. It runs entirely in your browser with no account, no signup, and your code is never uploaded.

Related Tools

More free converters that work the same way — right in your browser.

Try the related tools above, or go back to the Convertion homepage for more free converters.