HTML Formatter
Take minified or hand-mangled HTML and lay it out so you can see the structure. Void elements like <br> and <img> are treated correctly — they never open a level, which is what makes naive formatters drift a level deeper with every image on the page — and the contents of <pre>, <script>, <style> and <textarea> are copied through byte for byte, because re-indenting those changes what they do.
Nothing is uploaded — this tool runs inside your browser, so your files never leave your device.
Why use this tool
- Void elements don't open an indentation level
- Contents of pre, script, style and textarea are left exactly as they are
- Single-value elements like <title>Page</title> stay on one line
- A > inside a quoted attribute doesn't end the tag
How it works
- 1Paste the HTML you want to read.
- 2Choose two spaces, four spaces or tabs.
- 3Copy the result out.
HTML Formatter — frequently asked questions
Usually not, but it can. Whitespace between inline elements is rendered — `<span>a</span> <span>b</span>` has a visible space, and moving those spans onto separate lines keeps a space there, while joining them removes it. This formatter collapses runs of whitespace to a single space rather than removing them, which preserves the common case, but check anything whitespace-sensitive before shipping.
More developer tools
Looking for something else? Browse all developer tools
Explore the other tools
Same deal everywhere on the site — free, no sign-up, and no watermark on anything you download.
Or see every tool on one page.