HTML, CSS and JS Minifier
Strip comments and extra whitespace safely, then copy the output or download it as a .min file.
Tool
This tool minifies HTML, CSS, JavaScript and JSON: it removes comments, blank lines, indentation and the whitespace around punctuation, and touches nothing else. Strings, the inside of url(), template literals, regular expressions, the contents of pre, textarea, script and style, conditional comments and license comments starting with /*! are kept as they are; in HTML no tag or attribute quote is ever dropped. Paste the code or upload a file of up to 2 MB; everything runs in your browser and the code is never sent to a server.
The result shows the size of the source and the output in bytes, the percentage saved and, if your browser supports it, the real gzip size of both. Pay attention to that last box: servers already send files compressed with gzip or brotli, and repeated whitespace and indentation take up very little room once compressed, so minification on its own brings a limited speed gain and only becomes meaningful together with compression. For page speed, compression and cache headers, image sizes and unneeded scripts usually matter more.
The tool does not shorten variable names, transform code, rewrite CSS values (0.5 stays 0.5, 0px stays 0px) or remove empty rules; this limit is deliberate so that the output behaves exactly like the source. In JavaScript line breaks are preserved, so automatic semicolon insertion is unaffected; the division versus regular expression decision, however, is made from the previous token and JSX is not supported. Build tools such as Vite, Next.js and webpack already do this job; this tool is for small sites without a build step, single files and quick checks. Always keep the source file and never edit the minified one by hand.
FAQ
Why did the output shrink less than I expected?
The tool only removes comments and whitespace; it does not shorten names or transform code. Files that are already compact or have few comments change little. If the server uses gzip or brotli the difference shrinks further, and the gzip box shows exactly that.
Is the JavaScript output safe?
Line breaks are preserved, so automatic semicolon insertion behaves the same; strings, template literals and regular expressions are left untouched. The division versus regular expression decision is based on the previous token and can be wrong in very rare cases, so open the page and check the console before publishing. For a production build use esbuild, terser or your project's build tool.
Is my code sent anywhere?
No. The code you paste or upload is processed only in your browser; the gzip estimate is also computed with the browser's own compression interface. Refreshing the page clears everything.
Can I edit the minified file later?
Always edit the source file and minify again; manual changes in a file collapsed to one line both cause errors and get lost on the next run. Keep the source under version control and treat the minified file as build output.
