HTML Pretty Printer

Format HTML cleanly with 2-space indentation, keeping pre, script and style elements untouched in their original form. Runs in your browser, GDPR-compliant.

How useful is this tool?

The result will appear here …

How to use this tool (video)

This video is hosted on YouTube. When you play it, data may be sent to Google.

HTML Pretty Printer

The HTML Pretty Printer formats your HTML source cleanly and readably. Every block element is placed on its own line and indented with two spaces per nesting level. Inline elements such as span, a or b stay together in the text flow. This makes even heavily minified HTML quickly readable.

What can you format with it?

  • Minified HTML source from CMS, email templates or snippets
  • Third-party source code for review and further processing
  • Your own markup for a clean record or for sharing

The content of pre, textarea, script and style is left untouched, so code and preset line breaks are not destroyed. Attributes and their order are preserved exactly. You can copy the result or download it as a .html file.

Does the tool work locally?

Yes. The entire formatting runs in your browser. Your HTML code is not transmitted to our server or stored.

Frequently asked questions

How does the indentation work?

Block elements such as div, section, ul or table are placed on their own lines and indented with two spaces per depth. Inline elements and text inside a block stay together on one line.

Why is pre, script and style content left unchanged?

In these elements the line breaks and formatting are meaningful, for example with source code or preformatted text. The formatter therefore leaves them exactly as entered.

What happens with invalid or incomplete HTML?

The tool works tolerantly. Unclosed tags are resolved at the appropriate places and indented correctly. The result is a readable, freshly formatted source.