JS minifier
About the JavaScript Minifier
The JavaScript Minifier shortens variable names, removes whitespace and and strips comments. Output is functionally identical to the input and safe to ship to production.
How to use it
- Paste your JS source.
- Inspect the byte savings.
- Copy the minified file.
Tips
- Always keep the unminified version in version control.
- Run your tests against the minified output before deploying.
- For source maps, use a build pipeline rather than an online tool.
JavaScript files full of indentation, blank lines and comments can be several times larger than they need to be, and that extra weight costs your visitors download time. This minifier condenses a JavaScript script — removing unnecessary whitespace and comments — while leaving the behaviour intact, so the file you serve is smaller and loads faster.
It is the standard shipping step for front-end code: keep the readable source for development, then serve the compact minified script to the browser.
How to Minify JavaScript
- Paste your JavaScript source.
- Read the minified output, with redundant whitespace and comments removed.
- Copy it as your production script or into a build step.
Practical Use Cases
Shrink a script you serve directly to cut page weight, prepare a production version of a widget or utility, and reduce the bytes a visitor downloads on a slower connection.
A Caution
Minification that removes whitespace is safe for well-formed scripts, but always re-test the minified script in a quick run. If your code relies on unusual formatting edge cases, verify it behaves the same after condensing.
JS minification — common questions
Is minified JavaScript still readable?
No, and that is the point. The compact output is meant for serving, not editing. Keep a readable original for maintenance and deploy the minified version.
Does it change how my code runs?
For well-formed scripts, removing whitespace and comments leaves behaviour unchanged. Always run a quick test of the minified output to be safe.
Is it the same as obfuscation?
No. Minification only reduces size and does not aim to hide the code, whereas obfuscation deliberately makes it hard to read. This tool focuses on size.
Similar tools
Minify your HTML by removing all the unnecessary characters.
Minify your CSS by removing all the unnecessary characters.
Popular tools
Compress and optimize images for a smaller image size but still high quality.
Easily convert Days time units to Months with this easy convertor.
Find A, AAAA, CNAME, MX, NS, TXT, SOA DNS records of a host.
Count the amount of characters and words of a given text.
Generate passwords with custom length and custom settings.
Check if the URL is banned and marked as safe/unsafe by Google.