JS Minifier
Paste JavaScript and get a smaller, minified version.
How to use JS Minifier
- Paste your JavaScript into the box.
- The minified version appears automatically, with the percentage size reduction shown next to it.
Frequently asked questions
Is it safe to minify code that has a URL like "http://example.com" in a string?
Not entirely — comment stripping is a plain regex looking for "//", with no awareness of string literals, so "http://example.com" inside a string gets treated as a line comment starting at the //, and everything after it on that line is deleted. Check the output carefully if your code has URLs in strings.
Does the minified code always behave identically to the original?
Only if your code avoids // or /* */ sequences inside string literals, regex patterns, or template strings — since comment removal doesn't distinguish those from real comments, it can end up deleting part of a string by mistake.
How is the "% smaller" figure calculated?
Straight character count — original length minus minified length, divided by original length. It's not measuring gzip size or anything about runtime performance.
Community
Loading...