All tools
HTML Minifier
Options
Remove comments
Conditional comments for old Internet Explorer stay.
Collapse whitespace
Runs of spaces and line breaks become one space; <pre> and <textarea> are left alone.
Minify inline CSS
In <style> blocks and style="…" attributes.
Remove attribute quotes
class="a" becomes class=a where valid. Skip it if the HTML is read as XML.
HTML
Clear
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title> My page </title> <!-- Styles for the hero --> <style> .hero { color : #ffffff ; padding : 24px 16px ; } .hero h1 { margin : 0 } </style> </head> <body class="home page"> <!-- Main content starts here --> <section class="hero"> <h1> Hello, <b>world</b>! </h1> <p> Whitespace between words is squeezed down to one space, but the space between <em>inline</em> <strong>elements</strong> stays. </p> </section> <pre> Preformatted text is left exactly as it was written. </pre> </body> </html>
Minified HTML
Copy
Download
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>My page</title><style>.hero{color :#ffffff;padding :24px 16px}.hero h1{margin :0}</style></head><body class="home page"><section class="hero"><h1>Hello, <b>world</b>!</h1><p>Whitespace between words is squeezed down to one space, but the space between <em>inline</em> <strong>elements</strong> stays.</p></section><pre> Preformatted text is left exactly as it was written. </pre></body></html>
Original
707 B
Minified
473 B
Saved
33%