JavaScript Minifier
Minify JavaScript by removing comments and unnecessary whitespace.
This is a lightweight minifier best for simple scripts. String, template and regex literals are preserved exactly, but for production builds, use a tool like esbuild, terser, or a bundler.
Frequently Asked Questions
What does this minifier do?
It strips comments, collapses whitespace, removes spaces around operators and punctuation, and restores required spaces after keywords like return and typeof.
Is it safe for all JavaScript?
This is a regex-based minifier suited to simple scripts. It does not parse strings or regex literals, so for complex or production code use esbuild or terser. Always test the minified output.
How much can I save?
Usually 20–50%, depending on the amount of whitespace and comments in the original code.
Is my code sent anywhere?
No. Minification happens entirely in your browser. Your code never leaves your device.
Related Tools
CSS Minifier
Minify CSS code to reduce file size and improve page load speed.
JSON Formatter
Format, validate, and beautify JSON data with syntax highlighting.
HTML Entity Encoder/Decoder
Encode and decode HTML entities like &, <, >.
Base64 Encoder/Decoder
Encode and decode text to and from Base64 format.