HTML Uncompressor
Reduce the size of entered HTML by removing unnecessary formatting.
About HTML Uncompressor
Minified HTML from a page source, an email template or a CMS export arrives as one long line that is almost impossible to read. When you need to find a broken tag, edit a section or understand a layout, breaking it back into indented lines makes the structure visible again.
How it works
A line break is inserted wherever one tag is followed by another, with only whitespace between. Each line is trimmed and indented by two spaces per nesting level. A line that consists of a single opening tag increases the indent for following lines; a line starting with a closing tag reduces it. The void tags br, hr, img, input, meta and link do not increase the indent. Text and tags on the same line, such as '<p>Hello</p>', stay together. It is not a full parser, so unusual markup may indent unevenly. The result downloads as formatted.html.
How to use HTML Uncompressor
- Enter the text or data in the format shown in the text box above (Paste minified HTML to format).
- Select “Format HTML” and check the result before copying or downloading it.
Worked example
Paste '<div><h1>Hi</h1><p>Text<br>more</p></div>'. The output is four lines: '<div>', ' <h1>Hi</h1>', ' <p>Text<br>more</p>', and '</div>'. The <br> stays inline because text follows it rather than another tag.
Tips for a better result
- Expect drifting indentation after void tags not in the built-in list, such as <source>, <wbr> or <col>; writing them as self-closing, like <source />, avoids this.
- Use the formatted output for reading and debugging, then compress it again before deploying if size matters.
- Inline scripts and styles are not reformatted, so run them through a separate JS or CSS beautifier if you need to read them.
Frequently asked questions
Does it fix invalid HTML?
No. It only adds line breaks and indentation. Missing closing tags or mismatched nesting are kept as they are, though uneven indentation in the output can help you spot them.
Will it change how the page looks?
Usually not, but adding line breaks between inline elements can introduce small spaces between them when rendered, for example between adjacent images or links.
Can I choose tabs or 4-space indentation?
No. Indentation is fixed at two spaces per level. Use Replace Tabs with Spaces or your editor if you need a different style.
What to check
Test generated markup in your own page. Sanitize untrusted content before inserting it into a live website.
Read the Privacy Policy for information about local processing, connected services and advertising.