JavaScript Minifier

Compress JavaScript by stripping comments and whitespace — safe, no mangling, free.

Input JavaScript
Minified Output
Original: 0 BMinified: 0 BSaved: 0.0%

JS Full Form

JS is short for JavaScript — the programming language of the web browser. JS source files are written with generous indentation, comments, and line breaks that the JavaScript engine parses and then discards. Minification strips those tokens so your browser downloads and parses a smaller file, improving page load time.

What this tool does

  • Strip comments — Removes // line comments and /* ... */ block comments (license blocks starting with /*! are preserved).
  • Collapse whitespace — Removes indentation, newlines, and redundant spaces, keeping one space only where required to separate identifiers or reserved words.
  • Respect strings — String literals, template literals, and regular expressions are left byte-for-byte identical.
  • Safe mode — No identifier renaming (mangling), no scope hoisting, no dead-code elimination. Your code runs identically.
  • Byte savings — See original vs minified byte counts and percentage saved.

When you need a JS minifier

  • Production deploys — Smaller .js bundles download and parse faster, improving Time to Interactive.
  • Inline scripts — When embedding JS in HTML or email, every byte matters.
  • Scripts in user content — When a CMS stores JS in a database row and you need it compact.
  • Learning — Paste minified code and hit Beautify to see what a tool like Webpack actually ships to the browser.

Privacy

Everything runs locally in your browser. Your JavaScript is never sent to our servers, not even for analytics. You can minify proprietary business logic, unreleased features, or internal tooling without anything leaving your machine.

Frequently Asked Questions

No. Mangling is the aggressive technique of renaming myLongVariableName to a to save bytes. It requires full scope analysis and can break code that relies on reflection or dynamic lookup. This tool deliberately does not mangle — your identifiers stay exactly as you wrote them.
Yes, for standard ES5/ES6+ code. The tokenizer respects string literals, template literals (including ${...} interpolation with nested braces), regex literals, and automatic semicolon insertion. It preserves the space after reserved words like return, typeof, new and before identifiers to keep parsing correct.
Hand-authored JS shrinks by 30–50% from whitespace and comment stripping alone. Aggressive minifiers like Terser add another 10–20% through mangling and dead-code elimination. After gzip the wire savings are smaller but still real.
For a one-off minify of a self-contained script — this tool, in seconds. For a build pipeline shipping a bundled app to production — use terser or esbuild: they parse to an AST, mangle safely, eliminate dead code, and produce the smallest possible output.
No. All minification happens in your browser. Nothing is sent to our servers, logged, or cached anywhere except the current browser tab.
Click Beautify to add newlines after ; and {. It's not a full reformatter — for proper indentation and spacing, run the output through Prettier or your editor's format-on-save.