HTML Minifier
Minify HTML in your browser: remove comments, line breaks and extra spaces between tags, and see the size saved. Copy the result in one click.
Minify HTML in your browser: remove comments, line breaks and extra spaces between tags, and see the size saved. Copy the result in one click.
About this tool
This HTML minifier makes an HTML page or snippet smaller by removing the parts a browser does not need to display it. Paste your HTML and the minified version appears at once, with the original size, the new size and the percentage saved, measured in bytes. Three things are removed. HTML comments are deleted, including notes left for other developers and commented-out markup. Line breaks and indentation are removed, so the whole document becomes one line. Runs of spaces are collapsed to a single space, and whitespace between tags — the space and new line between one closing div tag and the next div, for example — is removed, along with stray spaces around the equals sign in attributes and before the bracket that closes a tag. On typical hand-written or template-generated HTML this saves 10 to 30 percent, which means faster downloads for email templates, landing pages, embedded widgets and HTML stored in a database or a CMS field with a length limit. Everything runs in your browser; your markup is not uploaded. Because it is a fast whitespace-and-comment minifier rather than a full HTML parser, it treats the whole input the same way, and that matters in a few places. Whitespace inside pre and textarea elements is collapsed too, so preformatted code blocks lose their indentation. A space between two inline elements, such as a bold “Hello” followed by an italic “world”, is removed and the words run together. Inline script code is put on one line, so any // comment in it would comment out the code after it. Conditional comments for old Internet Explorer are removed with the other comments. For pages with those features, minify the CSS and JavaScript separately, keep pre blocks out, and always check the minified page in a browser before publishing. For a production build, a build-step minifier (in your framework or bundler) is the safer choice; this tool is ideal for quick jobs.

A full page, an email template or a snippet.
Comments, line breaks and extra spaces are removed at once.
Original size, new size and percent saved.
Copy the result and check the page in a browser.
The minified HTML appears as you paste.
Developer notes and commented-out markup are dropped.
Indentation, line breaks and gaps between tags are removed.
See the bytes before and after and the percent saved.
Your markup stays in your browser.
Nothing to install for a quick one-off minify.
Smaller markup, same page
Gmail clips messages larger than about 102 KB.
ExampleMinify a newsletter template so the footer is not cut off.
Custom HTML blocks sometimes have a length limit.
ExampleShrink a widget so it fits a 10,000-character field.
Single-file pages load faster with less markup.
ExampleSave 20% on a hand-written promo page before upload.
Embed codes pasted into other sites should be compact.
ExampleMinify a booking widget’s HTML before sharing it with clients.
See how much of a page is whitespace and comments.
ExamplePaste a template to see if minifying is worth adding to your build.
Comments can reveal notes you do not want public.
ExampleStrip TODO notes from a page before sending it to a client.
Check these before you publish
A space between inline tags, such as a bold word and an italic word, is removed and words join up. Put the space inside a tag, or check the text after minifying.
Whitespace in pre and textarea elements is collapsed too. Minify the rest of the page and paste those blocks back.
Code goes on one line, so a // comment in a script block hides the code after it. Use /* */ comments or move scripts to a file.
Senior Software Engineer · Developer of Toolyconvert
Hemant developed HTML Minifier and tests it on desktop and mobile with real files. He is a senior software engineer from Dehradun, India, building websites since 2014, and designed and developed Toolyconvert end to end.
Last updated 24 November 2026
Featured on
Toolyconvert is listed on these product directories and launch platforms.