Formatted HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Hello</title>
  </head>
  <body>
    <!-- Main content -->
    <main class="page">
      <h1>Welcome</h1>
      <p>This is <strong>bold</strong>and <em>italic</em> text.</p>
      <ul>
        <li>One</li>
        <li>Two</li>
      </ul>
    </main>
  </body>
</html>

How to use the HTML Formatter

  1. Paste your HTML
  2. Choose Beautify to indent it or Minify to compress it
  3. Adjust indentation or comment removal
  4. Copy the result

Features

  • Beautify and minifyReadable, indented markup or compact production HTML from the same input.
  • Safe for code blocksContent inside pre, textarea, script and style tags is preserved.
  • Size savingsSee how many bytes minification saves.

Frequently asked questions

Will minifying HTML break my page?

It removes comments and collapses whitespace between tags. Whitespace inside text and in pre and textarea elements is preserved, so pages render the same.

Are conditional comments kept?

Yes. Internet Explorer conditional comments (<!--[if …]>) are always kept, even when comment removal is on.

Does it validate my HTML?

No. It formats whatever you paste without rejecting it, so it also works for templates and fragments. Use the W3C validator to check for errors.

How much smaller does minified HTML get?

Typically 10–25%, depending on how much indentation and how many comments the original has. Server compression (gzip or Brotli) reduces it further.

Is my data sent to a server?

No. Everything runs in your browser, so the data you paste never leaves your device. It is safe to use with private or production data.

All Developer Tools