Skip to main content
JoliTools

HTML Minifier

Remove unnecessary HTML whitespace and comments to create compact markup.

Minified output
Minified HTML appears here…

Basic minifier: it removes HTML comments and collapses whitespace. Content inside <script>, <style>, <pre> and <textarea> is left untouched, and it does not remove optional tags or shorten attributes. Everything runs in your browser, nothing is sent or stored anywhere.

About this tool

HTML Minifier makes HTML markup more compact by removing unnecessary whitespace, line breaks, and supported comments. It keeps the document structure while reducing extra formatting that browsers generally do not need to display a page. Compact HTML can be useful when preparing website files for production.

A webpage might contain many lines of neatly indented HTML with blank spaces between elements. That layout is helpful while building the page, but it can make the source file larger than necessary. Minifying the markup creates a more compact version that is easier to transfer as part of a production website.

How to use the html minifier

  1. 1Paste your HTML markup into the input editor.
  2. 2Choose the available minification options.
  3. 3Run the minifier to create compact HTML.
  4. 4Review and copy the result.

Good to know

Keep a readable original file before minifying HTML. Removing comments may also remove useful notes, licensing information, or instructions that should remain in the published source. Be careful with whitespace inside text elements, preformatted sections, and content where spacing affects what visitors see. A simple minifier may not understand every special case in HTML or embedded scripts and styles. Review the output in a browser before publishing it. Minification can reduce source size, but the actual improvement depends on how the original document was written. Processing happens locally in your browser. Your HTML is never uploaded to JoliTools.

Frequently asked questions

It removes unnecessary whitespace, line breaks, and supported comments to make HTML source code more compact.

More free tools you might find useful.

Part of Developer Tools on JoliTools, free tools, no sign-up.