About this tool
Compress standalone JavaScript snippets with an explicit optimization policy and inspect byte savings before downloading the verified result.
JS Minifier is strongest for standalone scripts, embeds, widgets, and experiments where someone needs smaller JavaScript output without opening a bundler. It gives quick feedback on compressed code size and is useful for checking how a snippet behaves after minification.
- Runs Terser 5.46.0 in a disposable Web Worker with a 10-second processing limit rather than blocking the page during minification.
- Separates script and ES module optimization assumptions and exposes compression, local or top-level name mangling, name retention, license comment, ASCII-only, and ECMAScript output policies.
- Reports parser locations and byte savings and enables copy or download only after the result remains identical under the same minification policy.
How to use JS Minifier
Paste the JavaScript, run the minifier, and review the output before copying it into the target embed or prototype. For larger applications, keep your normal build system for production bundles and use this page mainly for snippet-level checks or manual compression tasks.
When this tool is useful
- Runs Terser 5.46.0 in a disposable Web Worker with a 10-second processing limit rather than blocking the page during minification.
- Separates script and ES module optimization assumptions and exposes compression, local or top-level name mangling, name retention, license comment, ASCII-only, and ECMAScript output policies.
- Reports parser locations and byte savings and enables copy or download only after the result remains identical under the same minification policy.
Examples you can test
Load an example, compare the result with the expected output, then replace it with your own input.
Minify a small embed script
Example input
function greet(name) { console.log('Hello ' + name); }Expected output
function greet(o){console.log("Hello "+o)}Snippet minification is useful for embeds and prototypes, while production apps should use the build pipeline.
Compare script size
Example input
A formatted widget script
Expected output
Minified output with reduced whitespace and shorter syntax
Review size savings and behavior before replacing readable source code.
Validation checklist
- Keep the original readable JavaScript as the source of truth.
- Test behavior after minification when the script will run in production.
- Avoid pasting secrets, tokens, or private code into shared examples.
- Check browser compatibility if minification rewrites modern syntax.
- Use source maps or original files when debugging minified production code.