Skip to content
gohacks.dev
Web

HTML Formatter and Minifier

Indent minified HTML so it can be read, or minify it, keeping the contents of pre, script, style and textarea exactly as they were.

Free · No sign-up · Your inputs stay in your browser

Input

Format or minify HTML

Output

Result

503 characters

Contents of pre, script, style and textarea are kept byte for byte. Minifying removes the whitespace between tags, which can close a visible gap between two inline-block elements; check the page after.

Runs in this browser. Nothing you paste is sent to a server.

Whitespace can be content

Between inline elements, whitespace renders as a space. Minifying <a>One</a> <a>Two</a> joins the two links, and removing the gap between inline-block elements changes a layout. Check the page after minifying; a build tool with an HTML-aware minifier knows these cases.

Reading generated HTML

The common use is the other direction: a server-rendered page, an email template or a scraped document arrives as one long line. Formatting it makes the structure visible. The browser's own view is in DevTools' Elements panel, which shows the DOM after scripts ran rather than the HTML that was sent.

Share

Frequently asked questions

Does minifying HTML help performance?
A little. Compression with gzip or Brotli already removes most of the cost of whitespace, so minifying usually saves a few percent of the transferred size.
Why is my script unchanged?
Contents of script, style, pre and textarea are kept exactly, because whitespace there is meaningful or belongs to another language.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools