HTML Prettifier

The HTML Prettifier Tool formats and indents messy or minified HTML code for improved readability. Customize your indentation style, collapse blank lines, and instantly preview the results. Ideal for developers, designers, or anyone editing raw HTML. Includes live preview, copy, and export options.

Paste your input above or import a file below.
No file chosen
Supported file types: .txt, .html
Total characters: 0
Options
Indentation:
Minify instead of prettify
Remove HTML comments
Sort tag attributes

How to Use:

  1. Paste or type your HTML code into the input box.
  2. Adjust the indent string (e.g., 2 spaces, 4 spaces, or tab).
  3. Toggle the “Collapse Empty Lines” option to condense output.
  4. Click “Prettify” or type to see the formatted HTML update instantly.
  5. Use “Copy Output” or “Export to File” to save your result.

What the HTML Prettifier Tool Can Do:

This tool formats HTML by properly indenting nested tags and splitting tags across lines. It lets you define your indentation string and clean up unnecessary blank lines. Output updates live as you type or import code, and the result can be copied or downloaded as an HTML file.

Example:

Input:

<div><p>Hello</p><ul><li>One</li><li>Two</li></ul></div>

Output:

<div>
<p>Hello</p>
<ul>
<li>One</li>
<li>Two</li>
</ul>
</div>

Common Use Cases:

The HTML Prettifier Tool is perfect for beautifying pasted HTML, reviewing raw markup, or preparing minified code for editing. It’s especially useful for developers, content managers, and anyone working directly with HTML structure.

Useful Tools & Suggestions:

After prettifying your HTML, HTML Minifier is a solid next step if you’re prepping the page for deployment it strips out all the extra space without touching functionality. And if you’re working with legacy markup or mixed formats, Strip HTML Tags from Text can help extract just the readable content.