HTML, CSS & JS Minifier
Strip comments and unnecessary whitespace from HTML, CSS and JavaScript to shrink your files, and see exactly how many bytes you saved.
How to minify code
- Choose HTML, CSS or JavaScript and paste your code.
- The minified version appears instantly with the bytes saved. For HTML you can enable aggressive whitespace removal.
- Copy or download the result and use it in production. Keep your original source for editing.
Features
Three languages
HTML (with inline CSS and JS), CSS and JavaScript.
See the savings
Original, minified and percentage reduced.
Safe by design
Removes comments and whitespace only; never renames variables.
Private
Everything runs in your browser; nothing you paste is uploaded.
Frequently asked questions
What does minifying do?
It removes comments, line breaks and spaces that browsers do not need, making files smaller so pages load faster. The code behaves exactly the same.
Does the JavaScript minifier rename variables?
No. It performs safe whitespace and comment removal only, and keeps line breaks where removing them could change how the code is parsed. Build tools such as Terser or esbuild can shorten names for bigger savings.
Will minifying break my HTML?
Content inside <pre>, <textarea>, <script> and <style> is preserved correctly. By default one space is kept between inline elements; the aggressive option removes it, which can join words that were separated only by whitespace between tags.
Should I also use gzip or Brotli?
Yes. Minification and compression stack: minify first, then serve the file with Brotli or gzip, which your web server or CDN can usually do automatically.