About JavaScript Minifier
Strip comments, whitespace, and trailing semicolons from JavaScript. Reports byte savings and ratio. Useful for ad-hoc size estimates and small embeds. For production minification with mangling and dead-code elimination, use a real bundler (esbuild, swc, terser).
When this is the right tool
- Inline scripts in HTML — small and infrequently changed
- One-shot embeds — analytics snippet, single-purpose script
- Quick size estimate — see how much your file compresses before deciding to bundle
- Removing comments before sharing — strip TODOs and NOTEs from a snippet
For application code, use a real bundler. The size difference is dramatic.
What gets stripped
- Single-line
//and block/* */comments - Whitespace between tokens (kept where required for parsing)
- Trailing semicolons inside blocks (where ASI handles them)
- Empty lines
What does not change:
- Variable names
- Function names
- String contents (including comments inside strings)
- Logic structure
Common workflows
Embed a small script in HTML. Minify, paste inside <script>...</script>. Saves bytes without a build step.
Estimate compression. Drop your file in, see byte savings. If saving is meaningful, your gzip will get even more — set up a real bundler.
Strip comments before sharing. Minify, then re-format with JS Formatter. Result: clean code without the developer’s TODOs.
Frequently asked questions
Is this real minification?
Will it break my code?
Does it handle JSX?
{/* comment */} drops cleanly.How much smaller will my code get?
For production, what tool?
Round-trip with the formatter?
Related tools
Last updated: 2025-01-15