HTML Formatter

Indent messy HTML so every nested tag lines up and is easy to read.

How it works

Pastes messy or minified HTML in and gets it back indented, so every nested tag lines up. Choose 2 spaces, 4 spaces or tabs. Text inside <pre>, <textarea>, <script> and <style> is left untouched so its meaning does not change.

Worked example

<div><h1>Title</h1><p>Hello <b>world</b></p></div> becomes an indented tree with each tag on its own line.

Good to know

Common questions

Does it change my content?
No. Only whitespace between tags changes.
Does it work on a full page?
Yes, including <head> and <body>.
Can it format CSS or JavaScript?
Use the CSS Formatter for CSS. Inline script and style content are left as they are.

More in Developer.