Our minifier doesn't just strip out random characters—it follows a specific logic to ensure your HTML remains functional while getting as small as possible. Think of it like packing a suitcase efficiently: you remove the bulky packaging but keep everything that actually matters.
What Gets Removed
- HTML comments – Those
<!-- like this -->notes you add for yourself or other developers. Browsers ignore them anyway, so they're just extra bytes. - Extra whitespace between tags – The spaces, tabs, and line breaks you use to make code readable. Browsers collapse multiple spaces into one, so we do that upfront.
- Unnecessary quotes – Around attribute values when they're not needed.
class="container"becomesclass=containerwhen safe. - Trailing spaces – Those invisible characters at the end of lines that serve no purpose in the final page.
What Stays Untouched
- Content inside special tags – Anything between
<pre>,<code>,<textarea>,<script>, and<style>tags stays exactly as you wrote it. Formatting matters there. - Conditional comments – Those special Internet Explorer comments like
<!--[if IE]>are preserved because some browsers actually read them. - Essential spacing – Single spaces between words in text content are kept. We're not mashing all your words together.
- DOCTYPE and important declarations – These need to stay in their exact format for browsers to understand them properly.
Note about performance: Our minification happens entirely in your browser using optimized JavaScript. Nothing gets sent to a server, which means your code stays private and the process is lightning-fast. We use efficient regular expressions and string operations that won't freeze your tab, even with large HTML files.