Skip to content
HTML → Minified HTMLDeveloper tools

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.

About this tool

About HTML Minifier

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.

HTML Minifier tool

Where minified HTML helps

Smaller markup, same page

Email templates

Gmail clips messages larger than about 102 KB.

ExampleMinify a newsletter template so the footer is not cut off.

CMS and database fields

Custom HTML blocks sometimes have a length limit.

ExampleShrink a widget so it fits a 10,000-character field.

Landing pages

Single-file pages load faster with less markup.

ExampleSave 20% on a hand-written promo page before upload.

Embeds and snippets

Embed codes pasted into other sites should be compact.

ExampleMinify a booking widget’s HTML before sharing it with clients.

Quick size check

See how much of a page is whitespace and comments.

ExamplePaste a template to see if minifying is worth adding to your build.

Remove developer comments

Comments can reveal notes you do not want public.

ExampleStrip TODO notes from a page before sending it to a client.

Minify safely

Check these before you publish

Watch inline spaces

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.

Leave pre blocks out

Whitespace in pre and textarea elements is collapsed too. Minify the rest of the page and paste those blocks back.

Inline scripts

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.

Minify CSS separately

For style blocks, a CSS minifier removes more.

Open CSS Minifier

Check in a browser

Preview the minified HTML before publishing.

Open HTML Viewer

Need it readable again?

Re-indent minified HTML to edit it.

Open HTML Formatter
Built & tested by

HemantInsights

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

Answers and guidanceFrequently Asked Questions
What does minifying HTML remove?
Comments, line breaks, indentation, repeated spaces and the whitespace between tags. The tags, attributes and text stay the same.
How much smaller will my HTML get?
Usually 10 to 30 percent for indented, commented HTML. The tool shows the exact bytes saved and the percentage.
Can minifying break my page?
It can in a few cases: text in a pre element loses its spacing, a space between two inline tags is removed, and // comments in inline scripts hide the code that follows. Check the page after minifying.
Does it minify inline CSS and JavaScript?
It removes their line breaks and extra spaces but does not rewrite the code. For full CSS minification use the CSS Minifier, and minify JavaScript in your build tool.
Is minified HTML better for SEO?
Search engines read minified HTML the same way. The benefit is a smaller, faster page, which helps users and page-speed scores.
Is my HTML uploaded?
No. Minifying happens in your browser.
How do I un-minify HTML?
Paste it into the HTML Formatter to add indentation and line breaks back. Removed comments cannot be restored.
More tools for your workflowRelated Tools

CSS Minifier

Minify CSS in your browser: strip comments, line breaks and spaces around braces, colons and semicolons, and see how many bytes you saved.

HTML Formatter

Beautify messy or minified HTML with clean indentation. Indent 2, 4 or 8 spaces, line wrapping, inline scripts and styles indented too.

Live HTML Viewer

Write or paste HTML, CSS and JavaScript and see it render instantly in a safe, sandboxed preview, with a built-in console. Free, in your browser.

HTML Validator

Check HTML as you type: unclosed tags, double ids, missing alt text and labels, old tags. Each problem has its line number.

1 / 3
Browse all developer tools

Featured on

Toolyconvert is listed on these product directories and launch platforms.