Quick Answer
A JavaScript minifier removes comments, blank lines and unnecessary whitespace from your code, shrinking the file the browser has to download. This tool is deliberately conservative: strings, template literals and comments inside them are preserved exactly, so behavior never changes.
What This Tool Does
The minifier walks your code character by character, tracking string literals and comments so it never edits inside them. Comments are removed, whitespace runs collapse to a single space, and spaces around punctuation are dropped where it is safe. The result is smaller without changing what the code does.
Key Features
- String-safe — quotes, template literals and escape sequences are untouched.
- Comment removal —
// lineand/* block */comments are stripped. - Live savings — input size, output size and percentage saved shown in real time.
- Copy or download the minified file.
How to Use the JavaScript Minifier
- Paste your JavaScript into the input box.
- Read the minified output and the size stats.
- Click Copy or Download to take the result.
Use Cases
- Quickly shrinking a script before pasting it into a single-file page.
- Preparing an inline snippet where size matters.
- Seeing how much overhead comments and formatting add to a file.
Tips
- This is lightweight minification. For production, a real bundler also does dead-code elimination, which saves far more.
- Keep the readable source in version control; minify at build time.
- Test the minified output once before shipping — a quick smoke test catches surprises.
Privacy
Your code never leaves your browser. Safe even for proprietary scripts.
Conclusion
Smaller JavaScript means faster pages. Minify here, instantly and privately, then wire it into your real build pipeline.