JS Minifier Details
JavaScript Minifier removes comments and redundant whitespace from JavaScript to cut the file size.
Use it to tidy a small script before inlining it in a page, or to squash a snippet onto one line.
The workflow
Short version: give it input, run it, take the output. Details below.
- Paste the JavaScript into the box.
- Run the tool; comments and extra whitespace are stripped.
- Copy the result.
Limits and processing behaviour
Minification behaviour:
- Block comments are removed and runs of whitespace collapse to a single space.
- Whitespace around braces, semicolons, commas and colons is dropped.
- The code is processed in your browser, never uploaded.
- Identifiers are not shortened; this is whitespace and comment cleanup only.
Picking the right tool
For a modest saving this page is enough. For a real production build, use the minifier in your own toolchain such as esbuild or terser.
IMPORTANT: single-line comments (double slash) are not removed. Because the code ends up on one line, such a comment turns everything after it into a comment and the script stops working. Convert or delete line comments before minifying.
Quick tips
- Strip line comments first — that is this tool's known limitation.
- Check the browser console for errors before shipping the output.
- Server compression provides most of the real saving; treat minification as an extra step.
Data and privacy
This tool runs entirely in your browser, so what you type is not sent to the server. The only request that leaves is a counter with no content in it. Third-party advertising cookies may be present on the page, and they cannot read your input.