Free Online JavaScript Minifier
JavaScript minification removes comments and collapses whitespace to shrink a script's byte size — useful for inline `<script>` tags and quick experiments.
Your data is processed entirely in your browser and never sent to any server.
How to Use This Developer Tool
- Paste your JavaScript into the input area.
- Read the minified output below.
- Check the size reduction shown beneath the output.
- Click Copy to send the result to your clipboard.
What Is a JavaScript Minifier?
For production builds, you want Terser or esbuild — they do real work like renaming identifiers, dropping unreachable code, and inlining constants. For a one-off script you want to paste into a `<script>` tag, embed in an email, or attach to a CDN snippet, a comments-and-whitespace pass is usually enough and finishes instantly.
This minifier strips `//` line comments and `/* … */` block comments, then collapses consecutive whitespace. String literals (single, double, template) and regex literals are preserved byte-for-byte — what's inside the quotes or between the regex delimiters stays exactly as you wrote it.
Frequently Asked Questions
What does JavaScript minification do?
Is this safe for production?
Is minified code harder to debug?
Published by the WeGotEveryTool team. We build and test every tool in-house and update pages when the underlying spec, formula, or recommendation changes.
Reviewed: May 2026. Disclaimer: this tool is provided as-is for general informational use. For decisions with material consequences (medical, legal, financial, security) verify results against a qualified professional source.
Related Developer Tools
Format and beautify JavaScript code. Add proper indentation and line breaks for readability.
Minify CSS to reduce file size. Remove whitespace and comments for faster page loads.
Minify JSON by removing whitespace and unnecessary characters. Reduces file size for production and APIs.
Format and beautify HTML code with proper indentation. Make messy HTML readable and maintainable.