HTML Minifier
This tool minifies HTML. It removes comments and collapses white space between tags, and keeps the content of pre, textarea, script and style.
- Free, no sign-up
- Nothing is sent to a server
- Worldwide
How to use HTML Minifier online
- Paste the HTML. Type or paste your page.
- Choose options. Comments and white space.
- Read the result. The minified HTML appears with the bytes saved.
- Copy it. Copy or save the result.
Why use this free HTML Minifier
- Comments removed
- White space collapsed
- Pre and textarea kept
- Conditional comments kept
- Bytes saved shown
- Share by link
Smaller pages
HTML written for people has indentation, line breaks and comments. A browser does not need them to show the page. Removing them makes the file smaller, so it downloads faster. On a page that is sent many times, the saving adds up. The tool does this safely, and shows how many bytes it saved.
What is changed
Comments are removed, except conditional comments for old browsers. Runs of white space in text become one space, and white space between tags is removed. The spaces inside tags are tidied. The content of pre and textarea is kept exactly, and script and style content is trimmed but not changed inside.
A worked example
The sample has a div with a comment, a paragraph with extra spaces and a pre block. It is 89 bytes before and 64 bytes after, a saving of 28.1%: Hello world keep / this, where a slash marks a line break kept inside pre. The spaces in the pre block are kept.
Where white space matters
In HTML a space between two inline elements, such as two links, shows as a gap. Collapsing white space between tags keeps one space where text needs it only if there was text; if you rely on a gap between inline elements, check the page after minifying. You can turn the white space step off and only strip comments.
Related steps
Minifying is one of several ways to speed up a page, along with compressing responses on the server, minifying CSS and JavaScript, and optimising images. The HTML formatter does the reverse and makes minified HTML readable. Keep your readable source and publish the minified copy.
Using the tool
There is no button to wait for: the HTML Minifier result follows every change. Open a text file into the box, or drop one on it.
HTML Minifier: frequently asked questions
Does it change what the page shows?
Is pre content kept?
Are comments removed?
Can I keep the comments?
How do I make minified HTML readable?
Where does my text go when I use the HTML Minifier?
How do I keep the result of the HTML Minifier?
Related searches for HTML Minifier
- HTML Minifier online
- free HTML Minifier
- HTML Minifier online free
- HTML Minifier for mobile
- HTML Minifier without sign up
- HTML Minifier – Text & Writing Tools
HTML Minifier is a free online tool on MAITBOX, in the Text & Writing Tools group. It runs in your browser, so what you type is not sent to a server. It works on Android and iPhone, and on Windows, Mac and Linux, with no download and no account.