HTML / CSS Minifier

Strip whitespace and line breaks to compress code

Paste an HTML or CSS snippet to remove comments, extra whitespace and line breaks, compressing your code and showing the size savings instantly.

Minified output
Minified code will appear here.

About the html / css minifier

Minification removes characters that browsers do not need — comments, line breaks, and repeated whitespace — without changing how the code works. The result is a smaller file that downloads and parses faster, which is especially valuable on mobile networks and for large stylesheets.

This tool minifies HTML and CSS. HTML minification collapses whitespace between tags while keeping the meaningful content of <pre>, <textarea>, <script>and <style> blocks intact. CSS minification strips comments and unnecessary spaces around braces, colons, and semicolons.

Options

  • HTML — collapse whitespace between tags and remove comments.
  • CSS — strip comments and spaces around punctuation.
  • Size savings — see the byte size before and after, plus the percentage saved.

How to use the html / css minifier

  1. Choose HTML or CSS

    Pick the mode that matches the snippet you want to compress.

  2. Paste your code

    Drop your HTML or CSS into the input box — indentation and comments are fine.

  3. Copy the minified output

    The compressed code and size savings appear live — click Copy to use it.

Frequently asked questions

What does minification do?
It removes comments, line breaks, and extra whitespace that browsers do not need, producing a smaller file that behaves identically but downloads and parses faster.
Will minification break my HTML formatting?
No. Whitespace between block-level tags is collapsed, but content inside <pre>, <textarea>, <script> and <style> elements is preserved so your layout and code stay correct.
Does it remove CSS comments?
Yes. CSS comments are stripped entirely, along with spaces around braces, colons, semicolons and combinators, to produce the smallest valid stylesheet.
How much size will I save?
It depends on how much whitespace and how many comments your code has. The tool shows the original and minified byte sizes plus the percentage saved, so you see the exact result.
Is my code uploaded anywhere?
No. All minification runs entirely in your browser, so your code never leaves your device.

Other utilities