Menu
PDF Tools
Image Tools
Converters & Utilities
Seller & Print Tools
Accounting & Business
Calculators
Text & Writing Tools
Developer & Web Tools
Creator & Social Tools
Browser Utilities & Games
Document & Design Makers
Text & Developer Tools
Exam & Form Tools

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.

How to use HTML Minifier online

  1. Paste the HTML. Type or paste your page.
  2. Choose options. Comments and white space.
  3. Read the result. The minified HTML appears with the bytes saved.
  4. 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?
It should not, but check inline spacing.
Is pre content kept?
Yes, exactly.
Are comments removed?
Yes, except conditional comments.
Can I keep the comments?
Yes, turn off the remove comments option.
How do I make minified HTML readable?
Use the HTML formatter.
Where does my text go when I use the HTML Minifier?
No copy is made on a server; the HTML Minifier runs in your browser.
How do I keep the result of the HTML Minifier?
Press Use result as input and the HTML Minifier answer becomes the new input.

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.

More tools in Text & Writing Tools →

Search tools