JavaScript Minifier
Free JavaScript minifier: remove comments and extra whitespace to shrink JS files, with before and after size. Safe for strings and regex; runs locally.
FreeRuns in your browserNo sign-up
Your code stays in your browser.
Advertisement
How to use the JavaScript Minifier
- Paste your JavaScript.
- Click Minify.
- Copy or download the compressed file.
What minification does
Minifying removes comments, extra spaces and blank lines so browsers download less code. Smaller scripts load faster, which helps page speed and Core Web Vitals.
What this tool does and does not do
- Strips
//and/* */comments, without touching strings, template literals or regular expressions. - Collapses whitespace and removes spaces around punctuation.
- Keeps line breaks so code that relies on automatic semicolon insertion still works.
- Does not rename variables or restructure code. For maximum compression use a build tool such as Terser or esbuild.
Always test minified code before deploying.
Frequently asked questions
Is minified JavaScript the same as obfuscated?
No. Minifying only shrinks code. Obfuscation deliberately makes it hard to read.
How much will my file shrink?
Typically 20 to 60% depending on how many comments and blank lines it has.
Will minifying break my code?
This tool avoids risky changes, but always test the result.
Does it upload my code?
No.