Support
Dev Tools / Minify JavaScript Code

Browse by category

All categories

Minify JavaScript Code

Minify JavaScript code by removing whitespace and comments to reduce file size. Nothing logged, nothing sent.

1
Paste JavaScript
Paste your JavaScript code into the input area
2
Minify
The code is minified automatically with size reduction displayed
3
Copy result
Copy the minified JavaScript or download as a file

JavaScript Input

JavaScript Output

Output will appear here...
  • String, template-literal, and regex literals are preserved verbatim — no mangling of their contents.
  • Lightweight whitespace + comment stripper. For aggressive variable-mangling output, run through Terser locally.

Frequently Asked Questions

Are variable names renamed (mangled)?

No. This minifier does whitespace and comment stripping only — identifiers (`myVariableName`) pass through untouched. Variable mangling can change behaviour in code that uses `Function.prototype.name`, reflection, or stringified function bodies, so it's opt-in via a checkbox.

What modern syntax is supported?

ES2024 and earlier — arrow functions, async/await, optional chaining, nullish coalescing, private class fields (`#name`), top-level await, import assertions. If the input is valid modern JavaScript, it parses cleanly; stage-3 proposals may parse but without guarantees.

Does it strip `/*! license */` banner comments?

No. Comments starting with `/*!` (the widely-used license banner convention) are preserved verbatim at the top of the output. Regular `//` and `/* */` comments are removed.

This tool is free thanks to our sponsors. Support Loft Tools