HTML Beautifier & Prettifier

Format minified or tangled HTML into readable, indented markup.

convert² THE BEAUTIFIER
Enter format · K copy
INDENT
Input · raw
0 B 0 ln
1
Output · formatted
0 B 0 ln
{ }
awaiting input
paste code on the left
pick a format above
Original · A
0 B
Removed raw
Added
Original · B
0 B
↓ About this tool

HTML Beautifier & Prettifier

Format minified or tangled HTML into readable, indented markup.

What it does

HTML from the wire is often a wall of text: template engines strip whitespace, bundlers inline assets, and any readability that existed in source disappears. Beautifying puts it back on separate lines with visible nesting.

convert2's HTML mode understands HTML5 void elements — <br>, <img>, <input>, <meta>, <link> — so the output stays valid even when the input didn't self-close them.

How to use it

  1. Paste your HTML into the left pane.
  2. The indented version appears on the right.
  3. Void elements render correctly without forced closing tags.
  4. DOCTYPEs and comments are preserved verbatim.
  5. Change indent width from the top-right if your project uses tabs.

Example

Input
<!DOCTYPE html><html><head><title>Sample</title><meta charset="utf-8"></head><body><h1>hello</h1><img src="x.png"><p>world</p></body></html>
Output
<!DOCTYPE html>
<html>
  <head>
    <title>Sample</title>
    <meta charset="utf-8">
  </head>
  <body>
    <h1>hello</h1>
    <img src="x.png">
    <p>world</p>
  </body>
</html>

Why convert2

  • HTML5 aware. 15+ void elements handled — no orphan slashes on <img>.
  • Preserves inline scripts and styles. Content of <script> and <style> stays as-is, not re-indented.
  • Comment-safe. HTML comments keep their place.
  • Client-side. Same privacy promise as the rest of convert2.

Common use cases

  • Debugging server-rendered HTML that arrives minified.
  • Exploring the view-source of third-party sites without a dev tool.
  • Reading scraped HTML before feeding it into a parser.
  • Formatting email templates exported from tools that strip whitespace.
  • Inspecting what your SSR framework actually emits.

HTML Beautifier specifics

  • Recognises HTML5 void elements: area, base, br, col, embed, hr, img, input, link, meta, param, source, track, wbr.
  • Does not rewrite attribute casing — keeps whatever the input had.
  • Does not minify. For that, use a bundler's HTML minifier — convert2 focuses on readable output.
  • If your input is actually XML (strict namespaces, explicit self-closing), the XML mode may be a better fit.

Frequently asked questions

Does it handle HTML5 void tags like &lt;img&gt; and &lt;br&gt;?

Yes. Void elements are recognised and rendered without forcing a closing slash.

Can I paste an entire page including DOCTYPE?

Yes. Full HTML documents format correctly, including the DOCTYPE declaration and any metadata in the head.

Will it reformat embedded CSS or JavaScript?

No. Content inside <script> and <style> tags is preserved verbatim — the formatter doesn't try to be clever about two different languages at once.

Other tools

copied