Back to UtilityFast & Local
Code Minifier
Reduce your file size and improve website performance by removing comments and unnecessary whitespace from your JS, CSS, or HTML.
Result will appear here
Upload code to see compression stats.
Reduce your file size and improve website performance by removing comments and unnecessary whitespace from your JS, CSS, or HTML.
Result will appear here
Upload code to see compression stats.
Follow these straightforward steps to get your result in seconds.
Select HTML, CSS or JavaScript so the right rules are applied.
Add the full file or snippet. Keep a copy of your original.
The tool compresses the code and shows the size before and after.
Use the minified version on your page and check that everything still works.
Minifying strips out everything a browser doesn't need to run your code: comments, indentation, line breaks and extra spaces. The behavior stays the same, and the file gets smaller. Smaller files download faster, which helps page speed and the Core Web Vitals that Google looks at when judging page experience.
Minifying isn't the same as compressing. Gzip and Brotli compression happen on the server while the file is sent. The two work together, and a minified file also compresses well.
Minified code is hard for people to read, so don't edit it directly. Keep your readable source files, and use the minified output only for the live site. When you need to change something, edit the source and minify again.
If you build with Next.js, Vite, webpack or a similar tool, your production build already minifies the code for you. A standalone minifier is most useful for static HTML pages, CSS or scripts outside a build process, snippets for a CMS or email, and quick checks of how much a file could shrink.
| Language | Removed | Kept |
|---|---|---|
| HTML | Comments, extra spaces, line breaks between tags | Content, attributes, pre-formatted text |
| CSS | Comments, whitespace, trailing semicolons | All rules and values |
| JavaScript | Comments, whitespace, line breaks | Logic and behavior |
Everything you need to know about code minifier: minify html, css and javascript.