JS Minifier
Minify JavaScript in the browser by stripping comments, whitespace, and unneeded spaces around operators.
Input JavaScript
How to Use the JS Minifier
- Paste your JavaScript into the input box.
- Click "Minify JS" to remove comments and whitespace, or "Format JS" for a quick expanded view.
- Check the original size, minified size, and percentage saved.
- Copy the output or download it as app.min.js.
JS Minifier Features
- Lightweight comment and whitespace compaction
- Shows original vs minified byte count
- Zero server uploads for maximum privacy
Frequently Asked Questions
What does this JavaScript minifier do?
It removes // and /* */ comments, collapses whitespace and line breaks, and strips spaces around operators and punctuation. It does not rename variables or remove unused code the way full build tools do.
Is it safe to use on any JavaScript code?
It's a lightweight, text-based minifier that works well for small scripts and snippets written with semicolons. Code that relies on automatic semicolon insertion, or that contains regular expressions or strings with comment-like text, can break when line breaks are removed. Always test the output, and use a parser-based tool such as Terser, esbuild, or SWC for production bundles.
Does minifying protect my source code?
No. Minification only makes code smaller. Anyone can reformat minified JavaScript and read it, so never put secrets such as API keys in client-side code.