JavaScript Minifier
Minify JavaScript by stripping comments and extra whitespace locally.
JavaScript input
Note: lightweight minifier (removes comments/extra whitespace). For production use a full parser-based minifier.
Output
Size: 113 → 81 chars
How to use JavaScript Minifier
Paste JavaScript
Enter the script you want to minify.
Minify
Generate a compact version with comments and extra whitespace removed.
Copy output
Copy the minified code. Test it if you plan to use it in production contexts.
Frequently asked questions
Is my code uploaded?
No. Minification runs locally in your browser.
Is this safe for production?
It performs simple text-based minification. For production, prefer a parser-based minifier and thorough testing.
Does it rename variables or optimize logic?
No. It focuses on removing comments and unnecessary whitespace only.
Can it handle modern JavaScript?
It works for many common cases, but complex syntax edge cases are better handled by full minifiers.
Why is the output not much smaller?
Savings depend on comments/whitespace in the input. Advanced compression requires build-time tools.
About JavaScript Minifier
The JavaScript Minifier reduces script size by removing comments and unnecessary whitespace to produce a more compact version of your code. Paste JavaScript to quickly generate a minified output you can copy for simple embeds, tests, or lightweight delivery scenarios. All processing runs locally in your browser, so your source code stays on your device. This tool performs straightforward, text-based minification; for production-grade optimization (such as variable mangling and syntax-aware transforms) use a dedicated build-time minifier. It is ideal for quick cleanup and size checks during development.
Quick size reduction
Comments and formatting improve readability but increase file size. A simple minifier strips these elements to produce a denser representation that can be useful for sharing snippets, embedding scripts, or comparing approximate savings. Because this tool focuses on safe text-level transformations, it avoids complex rewrites that could change behavior, but it also does not perform advanced optimizations provided by parser-based tools.
When to use a full minifier
Modern JavaScript syntax, template literals, regular expressions, and automatic semicolon insertion edge cases can be sensitive to naive transformations. For production deployments, bundlers and minifiers like Terser or SWC analyze syntax trees to optimize safely. Use this browser tool for convenience and quick tasks, and rely on your build pipeline for critical assets. Always test minified output in your target environment if correctness matters.
Private, in-browser processing
Minification happens entirely on your device with instant results and no uploads. This is helpful when working with proprietary code or when you need a fast utility without installing tooling. Pair it with formatters and other developer utilities on the site to inspect, transform, and validate code snippets during everyday development and debugging.
Use JavaScript Minifier on your site
This tool runs free and private in the browser. Paste it anywhere — blog posts, documentation, team wikis — and your visitors will use it without leaving your site. The embed includes a small "Made with The Tools Today" credit link.
Related tools
CSS Formatter & Minifier
Beautify or minify CSS code instantly in your browser.
Open toolHTML, CSS & JS Minifier / Beautifier
Minify or beautify HTML, CSS, and JavaScript code locally.
Open toolJSON Formatter & Validator
Format, validate and minify JSON with helpful error messages.
Open toolRegex Tester
Test regular expressions with flags, matches, groups, and replace preview.
Open tool