JavaScript Minifier
Shrink JavaScript by stripping comments & whitespace, ASI-safe
Frequently Asked Questions
What does minifying JavaScript remove?
Comments, indentation, line breaks and spaces the parser does not need. Variable names and program logic are left alone, so the script behaves identically. This is a whitespace minifier, not an obfuscator or a name mangler.
What does "ASI-safe" mean?
JavaScript inserts semicolons automatically at certain line breaks, so blindly deleting newlines can silently change what a script does, most famously after a return statement. This minifier keeps every line break that carries meaning, which is why it will not break working code.
How much smaller will my file get?
Usually 20 to 40% for well-commented source, less for code that is already terse. The status bar shows the exact input size, output size and percentage saved for your own file.
Does it rename variables like a build tool does?
No. Tools such as Terser and UglifyJS shorten variable names for extra savings, but that requires a full parse and can break code that relies on names at runtime. This minifier deliberately stops at whitespace and comments so the result is always safe to ship.
Are strings and regular expressions safe?
Yes. Anything inside a quoted string, a template literal or a regular expression literal is copied through byte for byte, so spacing that matters to your output is never stripped.
Is my JavaScript sent to a server?
No. Minification happens entirely inside your browser, so nothing is uploaded or stored anywhere. Pasting private or client code is safe.