HTML Minifier

Formatted HTML
Size:0B
Lines:1
UTF-8
Minified HTML
Size:0B
Lines:1
UTF-8

Waiting for input.

HTML Minifier Options

HTML Minifier

HTML minifier is highly configurable online tool to minify HTML, it also minifies CSS and Javascript inside HTML. HTML minifier is minifies HTML content by removing all indentation in the content. It also minifies CSS and Javascript inside the HTML by removing comments, unwanted blocks and redundant statements.

This version of HTML Formatter is advanced and it minifies Javascript and CSS inside HTML as well.

HTML Minifier Options

By default, the HTML minifier minifies to achieve maximum minification so it can be directly used in production. Below are the exposed configuration options,

  • Minify CSS - Minifies CSS inside HTML.
  • Minify Javascript - Minifies Javascript inside HTML.
  • Parse as HTML5 - Parses HTML as HTML5 doctype and remove attributes needed in older versions.
  • Use Short Doctype - Replaces longer doctype with shorter, HTML5 version of doctype.

Below are the options which will remove unwanted attributes, blocks.

  • Remove Comments - Remove comments and special comments from HTML, CSS and Javascript.

  • Remove redundant attributes - If that attribute is not part of W3C for a html tag, it will be removed.

  • Remove type attributes in style, script tag - Removes type="text/javascript" in <scrip> tag and type="text/css" in <style> tag.

    Remove Empty Elements - Disabled by default, because if some elements are filled or updated in client side by javascript will break if we remove these tags.

    HTML Minifier Usage

    Below is beautifully formatted HMTL with CSS inside, just past your HTML similar to this in input and press format button.

    <html>
    <!-- Comments will be removed -->
    <head>
    <style type='text/css'>
    .dark: {
    /** This comment will be removed. */
    background: #121212;
    }
    </style>
    </head>
    <body>
    <input type='text' name='text' disabled='true'>
    </body>
    </html>

    Below is the minified HTML

    <html><head><style>.dark:{background:#121212}</style></head><body><input name="text" disabled></body></html>

    You can also format the minified HTML back using HTML Formatter Online Tool.