Home / Tools / HTML beautifier

HTML Beautifier: Format and Indent HTML Online

Paste HTML and get tidy, indented markup. It also formats inline CSS and JavaScript. Choose indent size and line width. Runs in your browser.

Paste your HTML, press Beautify and copy the neat result. Tags are indented by nesting level, long lines wrap at the width you choose, and inline style and script blocks are formatted too.

What it does

Example

Before

<!DOCTYPE html>
<html><head><title>My page</title>
<!-- styles -->
<style>body{margin:0}</style></head>
<body><div class="box"><h1>Hello</h1><p>Some <b>bold</b> text.</p><ul><li>One</li><li>Two</li></ul></div></body></html>

After

<!DOCTYPE html>
<html>
  <head>
    <title>My page</title>
    <!-- styles -->
    <style>
      body {
        margin: 0;
      }
    </style>
  </head>
  <body>
    <div class="box">
      <h1>Hello</h1>
      <p>Some <b>bold</b> text.</p>
      <ul>
        <li>One</li>
        <li>Two</li>
      </ul>
    </div>
  </body>
</html>

Frequently asked questions

Will it change how the page looks?
It keeps whitespace that matters, such as the spaces between inline tags and the text in pre blocks. Block elements may get line breaks that browsers ignore.
Does it fix broken HTML?
No. It does not add missing closing tags. Badly broken markup can produce an error or odd indentation.
Can I format only a fragment?
Yes. A fragment like a single div works as well as a full page.
Does it format templates such as PHP or Jinja?
Not reliably. It reads plain HTML, so template tags may confuse it.

Runs in your browser. Nothing you type is sent to this site. Updated 2026-10-11.

More tools

Code formatters

CSS beautifier CSS minifier HTML minifier JavaScript beautifier JavaScript minifier JSON formatter YAML formatter XML formatter SQL formatter Markdown preview

Converters

Base64 encoder and decoder URL encoder and decoder Unix timestamp converter CSV to JSON JSON to CSV HTML entity encoder and decoder Number base converter Time zone converter JSON to TypeScript XML to JSON HTML to Markdown Date difference calculator

Text tools

Regex tester Remove duplicate lines Lorem ipsum generator Word counter Case converter Text diff checker

Color and images

Color converter Contrast checker Image to Base64 Image resizer

Network

Subnet calculator Download time calculator Common ports list CIDR to IP range IPv6 address expander and compressor MAC address formatter curl command builder

Server and files

Cron expression explainer chmod calculator HTTP status codes

Encoding and security

Password generator UUID generator Hash generator JWT decoder QR code generator Password strength checker Wi-Fi QR code generator