Production-ready JavaScript
The minifier runs your code through Terser, the industry-standard JavaScript compressor. It removes whitespace and comments, mangles local variable names to single letters, and compresses the code by folding constants, removing unreachable branches and simplifying expressions — often cutting size by half or more.
You control the trade-offs: turn mangling off to keep names readable in stack traces, and keep /*! license */ comments to stay compliant with open-source licenses. Syntax errors are reported with their location, and the stats compare raw and gzipped sizes.
How to minify JavaScript
- 1
Paste your code
A script, module or snippet.
- 2
Choose the options
Compress, mangle names and keep license comments.
- 3
Review the size saving
Raw and gzipped.
- 4
Copy or download
Use the .min.js file.
Key features
Powered by Terser
The minifier behind most modern build tools.
Dead-code removal
Unreachable code and unused expressions are dropped.
License-friendly
Keep /*! … */ comments.
Local and private
Your source code isn't uploaded.
Common uses
- Small sites without a build step: Minify scripts before uploading.
- Bookmarklets and embeds: Keep snippets as short as possible.
- Checking bundle wins: See how much a refactor reduces size.
Tips and good to know
- Keep your original file — minified code is hard to edit. The JavaScript Beautifier can reformat it, but mangled names stay short.
- Combine with the HTML Minifier and CSS Minifier for a fully optimized page.
