JS Minifier

Shrink JavaScript.

Loading toolโ€ฆ

About JS Minifier

Paste JavaScript and get a smaller version fast. This tool does a safe, conservative minify: it strips // line comments and /* */ block comments, trims the leading and trailing spaces on every line, and removes blank lines. Your string, template, and regex contents are left exactly as written, so a // inside a URL or string is never touched.

It also shows the original versus minified byte size and the percentage saved, with one-click Copy and Download. It is completely free, requires no signup, and runs entirely in your browser. Your code is never uploaded to any server.

Frequently asked questions

Is the JavaScript minifier free to use?
Yes, it is 100% free with no signup, no limits, and no watermarks. Paste as much code as you like, as often as you like.
Is my code uploaded or stored anywhere?
No. All minification happens locally in your browser using JavaScript. Your source code never leaves your device and is never sent to a server, so it is safe for private or proprietary code.
Does this rename variables or fully compress my code?
No. This is a conservative whitespace-and-comment minifier. It removes comments, trims each line, and deletes blank lines, but it does not rename variables, shorten identifiers, or restructure code. For maximum compression, use a build-step tool like Terser or esbuild.
Will it break my strings, regexes, or URLs?
No. The tool tracks string literals, template literals, and regular expressions, so comments or slashes inside them (like // in a URL) are preserved exactly. It only strips comments and whitespace found in actual code.
What exactly does it remove?
It removes // single-line comments and /* */ block comments, trims leading and trailing whitespace on each line, and deletes empty lines. Internal spacing and newlines between statements are kept so the code stays valid and safe from automatic-semicolon-insertion surprises.
Should I test the minified output?
Yes. Although the minifier is designed to be safe and non-destructive, you should always test the output in your project before shipping it to production, especially for large or unusual codebases.