Minify
JavaScript Minifier
Paste JavaScript to shrink it by removing comments and excess whitespace. Strings are preserved.
Input
LocalOutput
—
About this tool
About JavaScript Minifier
The JavaScript Minifier shrinks code by removing comments and excess whitespace while preserving string contents. It is for developers reducing script size for production without a full build toolchain.
Smaller scripts download and parse faster. Minifying locally trims bytes while keeping your source readable, and your code is never uploaded.
How to use
Step by step
- Paste the JavaScript you want to compress.
- The minifier removes comments and unnecessary whitespace.
- String contents are preserved exactly.
- Review the minified script.
- Copy or download the minified script.
Key features
What it offers
- Comment and whitespace stripping — JavaScript Minifier
- String contents preserved
- No build step needed
- Runs on your device — JavaScript Minifier
Common use cases
Where it helps
- Shrinking a small script before deployment
- Compacting an inline snippet for a single page
- Reducing a utility file when no bundler is set up
- Quickly trimming code for a size-limited environment
Best practices
Tips for best results
- This performs whitespace and comment removal, not the aggressive renaming a full optimizer like Terser does.
- Keep the readable source and minify only what you ship.
- Test minified code, since removing comments can occasionally expose a reliance on specific formatting.
Benefits
Why people use it
Smaller scripts
Less to download and parse.
Faster loads
Lighter JavaScript improves page speed.
No tooling
Useful without a bundler.
Private
Your code stays on your device.
FAQ
Common questions
It removes comments and collapses whitespace while preserving strings, template literals, and regex. It does not rename variables, so it never breaks scope.
Mostly whitespace and comments. For maximum compression use a build-time tool like Terser.
No. Minifying runs in your browser.
Yes, the Validate button reports parse errors.
Private by design
This runs entirely in your browser
No file or text you enter here is uploaded. Encoding and decoding happen on your device using native browser APIs — close the tab and nothing remains on a server.