Anonymous user / 18.208.203.36 Log In Register
?
Wallet: 3.00
Daily Credits:
1.20 / 1.20

Minify HTML Online

 

Examples #

Try a few example inputs:
  • [TRY] A simple example with a special comment.
  • [TRY] A complex example showing many properties of the minifier.

See Also #

Description #

Minify HTML Online is a tool that allows you to minify your HTML resources. HTML minification is an optimization process that makes your HTML code smaller without changing its visual appearance for the end users and its functionality. It is a simple lossless compression, which benefits are obvious. If you have smaller HTML page to deliver to the user, you need smaller bandwidth and the user receives the content faster. Minification is recommended even if you use GZip compression, because the compressed minified resource is usually even smaller than compressed resource that was not minified.

Minify HTML is based on HTMLMinifier project by Juriy Zaytsev.

Usage #

Minify HTML Online supports many options, but the default settings were created for maximum compatibility and hence you can simply copy your HTML code into the Input HTML input field and hit the "Minify!" button. This is the simplest way to run this tool that produces maximal, or nearly maximal, savings and will not affect the code's functionality.

If you want to minify HTML code from a file on your disk, switch the Input type to File and use the Browser button to choose the source file.

Using the Max line length field, you can specify the maximum length of lines on the output.

The following options for advanced users are available:

  • Case sensitive – Treat attributes in case sensitive manner (useful for SVG; e.g. viewBox).
  • Collapse whitespace – Collapse white space that contributes to text nodes in a document tree.
  • Collapse boolean attributes – Omit attribute values from boolean attributes.
  • Keep closing slash – Keep the trailing slash on singleton elements.
  • Preserve line breaks – Always collapse to 1 line break (never remove it entirely) when whitespace between tags include a line break. Must be used in conjunction with the Collapse whitespace option.
  • Remove attribute quotes – Remove quotes around attributes when possible.
  • Remove comments – Strip HTML comments.
  • Remove comments from CDATA – Strip HTML comments from scripts and styles.
  • Remove empty attributes – Remove all attributes with whitespace-only values.
  • Remove empty elements – Remove all elements with empty contents.
  • Remove optional tags – Remove unrequired tags.
  • Remove redundant attributes – Remove attributes when value matches default.
  • Remove script type attributes – Remove type="text/javascript" from script tags. Other type attribute values are left intact.
  • Remove style link type attributes – Remove type="text/css" from style and link tags. Other type attribute values are left intact.
  • Use short doctype – Replaces the doctype with the short (HTML5) doctype.

Limits #

The input size is limited to 5 MB.