HTML written by hand or exported from an editor is full of indentation, blank lines and comments. None of it shows on the page, but all of it is downloaded on every visit. Jood's HTML minifier strips that out, minifies the CSS and JavaScript written inside the page along the way, and hands you a smaller file that displays just as before.
How to use it
Paste the page's code into the "Source Code" box, up to 2 MB.
Click "Start Now".
Copy the output with "Copy Result" and use it in place of the original code.
What the tool does
It removes comments but keeps the conditional comments Outlook and some older software rely on, such as <!--[if mso]>.
It shrinks every run of spaces and line breaks to a single space, and drops the spaces around structural tags like div, p, li and table.
It keeps one space between tags that sit inside a line of text, such as b, a and span, so words never run together.
It leaves the content of pre and textarea alone, because spaces there are part of the content.
It minifies the CSS in style tags and the JavaScript in script tags, and leaves scripts of other types untouched, such as JSON-LD data meant for search engines.
In our test, a small page with ordinary indentation, one comment, a style tag and a script tag went from 509 bytes to 389, about a quarter smaller.
Two cases where the layout can change
Side-by-side inline-block elements: if your menu is made of li items set to display: inline-block, the small gap between them came from the spaces in the code. After minifying, it is gone, so set it with margin or gap in your CSS.
Spaces preserved by CSS: if you use white-space: pre on an element other than pre, the spaces inside it will be collapsed. Put that text in a pre tag, or leave that page unminified.
Tips before you use it
Paste only the final HTML, the code the browser actually receives. A template file with PHP or another templating language may stop working, because the tool treats everything as HTML.
HTML emails benefit a lot: Gmail clips a message whose code goes over roughly 102 KB and hides the rest behind a "View entire message" link.
Keep the readable original for editing, and test the page after minifying.
For separate files, use the CSS minifier and the JavaScript minifier. Your code is sent to Jood's server, minified, and not stored.
We use cookies to measure traffic and improve the site (Google Analytics), and may show ads later. Nothing is enabled without your consent. Privacy policy