HTML Formatter
Beautify and indent HTML markup for readability.
HTML Input
Formatted HTML
About the HTML Formatter
The HTML Formatter re-indents markup so nested elements are readable at a glance. Paste minified or badly indented HTML and it returns the same document with consistent indentation, using two spaces, four spaces or tabs.
It changes only whitespace between tags, not the content, attributes or structure, so the page renders the same afterwards. That matters because whitespace is significant in a few places: inside pre and textarea, and in inline text where a space between words is content rather than formatting.
It does not validate or repair. An unclosed tag stays unclosed, and a malformed attribute stays malformed. Formatting is a readability step, not a correctness one.
Common questions about HTML Formatter
Does formatting change how the page looks?
No, as long as you keep the result out of pre and textarea. Whitespace between block elements does not affect rendering.
Can it fix broken tags?
No. It only re-indents. Use a validator to find structural errors.
Which indent should I choose?
Whatever your project already uses. Two spaces is the most common in web code.
Can it handle minified HTML?
Yes, that is its main use. A single-line document comes back indented.
Does it touch attributes or text?
No, only the whitespace between tags.
Is there a size limit?
Very large documents take longer in the browser. A few hundred kilobytes is fine.