Output will appear here...Well-formatted HTML is readable, maintainable, and easier to debug. Minified HTML reduces page weight by removing whitespace the browser ignores. This formatter handles both directions — pretty-printing for readability during development and minification for production — with correct handling of inline elements, pre-formatted blocks, and void elements.
Pretty-printed HTML expands code by 20–40% compared to minified, but becomes readable and maintainable. Minified HTML saves bandwidth (combined with gzip, the savings are usually 5–15% over already-compressed traffic). The most important HTML performance consideration is not minification but rather: reducing DOM complexity, eliminating render-blocking scripts and CSS, and optimising critical rendering path. Minification is a minor final-mile optimisation.
<pre> and <code> block contents without reformatting<br>, <img>) correctly in both HTML and XHTML modeMarginally at most. Page speed is a Google ranking signal, and faster load time helps. However, minification saves only a few KB on typical pages — the impact on Core Web Vitals is minimal compared to image optimisation, code splitting, and caching.
tags?
<pre> marks preformatted text where whitespace is significant — poems, code samples, ASCII art. Reformatting inside would change the visual output. The formatter treats <pre> content as opaque and preserves it exactly.
Use the URL Fetch option (if available) to load a URL's HTML directly into the formatter. Otherwise, view-source the page in your browser (Ctrl+U) and copy the raw HTML.
XHTML requires all void elements to be self-closing (<br /> not <br>) and all attributes to be quoted. HTML5 is more permissive. The formatter offers both modes to produce correct output for your target document type.
See also the CSS Minifier, JSON Formatter, and the Diff Checker.