Minify JS - Free JavaScript Minifier
Paste a script and get a minified version that keeps the same behavior while dropping comments and whitespace. The size report shows how much you saved, with everything processed in your browser.
JavaScript Minifier
LOCAL · Browser-OnlyMinify JavaScript code to reduce file size and improve load times
Smart minifier: full parse with variable mangling, expression compression, and dead-code elimination for maximum size reduction. Requires syntactically valid JavaScript.
Quick Start
- 1Paste your JavaScript into the input area
- 2Click Minify to compress the code
- 3Check the before and after size reduction
- 4Copy the minified output
What This Tool Does
There are two engines behind the button and they are not the same trade. Smart parses the whole script, renames local variables, folds constant expressions and removes code that can never run, which is where most of the size reduction comes from. Safe never parses: it strips comments and collapses whitespace and leaves every identifier alone.
Pick Safe when the input is a fragment, a snippet you are not sure will parse cleanly, or something you still need to be able to read afterwards. Pick Smart when it is a complete, valid file and you want the smallest possible output.
Four counters sit above the output: original size, minified size, percentage saved and raw bytes saved. Running an already-minified file through will show a small or zero saving, which is a useful check in itself.
Limits Worth Knowing
- Safe mode keeps one newline between statements so automatic semicolon insertion still behaves, which is why its output is not a single line.
- Safe mode checks its own work rather than guaranteeing it, and warns you if the output grew or if braces and brackets stopped balancing.
- Remove console.log removes exactly console.log. Calls to console.warn, console.error and console.info are left in place.
- Safe mode validates the input as a script, so a file using import or export is flagged even though the minified output is fine.
- There is no upload or download here. Paste the script in and copy the result out.
Common Questions
Does minifying rename my variables?
Is the output guaranteed to behave identically?
Can I minify CSS or HTML here?
More Minify Tools
All minifiers →Minify CSS Online
Compress CSS code by removing whitespace, comments, and redundant rules. Free online CSS minifier with size comparison.
Minify JavaScript Online
Compress JavaScript code by removing whitespace and shortening variables. Free online JS minifier with size comparison.
Minify & Optimize SVG Online
Optimize SVG files by removing metadata, comments, and unnecessary attributes. Free online SVG minifier.
Minify CSS Online Free
Minify CSS online free to shrink file size and speed up your site. Strips whitespace and comments in your browser, no upload, no signup.
Minify SVG Online Free
Minify and clean SVG code online for free. Removes editor metadata, comments, and redundant attributes to reduce SVG file size, no upload.
Looking for FAQs and advanced options? Visit the full JavaScript Minifier page →