HTML Formatter
Beautify messy HTML with consistent, readable indentation.
Turn compressed or badly indented HTML into clean, readable markup. The formatter understands nested elements, inline text, comments and void tags, and lets you choose two, four or tab indentation. It works offline in your browser and keeps your markup intact.
Tip: press Ctrl + Enter to format.
How to use HTML Formatter
- 1Paste HTML into the input field or insert the example.
- 2Select your preferred indentation and press Format HTML.
- 3Review the output, then copy or download it.
About this tool
Turn compressed or badly indented HTML into clean, readable markup. The formatter understands nested elements, inline text, comments and void tags, and lets you choose two, four or tab indentation. It works offline in your browser and keeps your markup intact.
Looking for more utilities? Browse all tools or explore HTML Tools.
Frequently asked questions
Does the formatter change my HTML?+
It only changes whitespace between tags. Attributes, text and element order are preserved.
Does it support HTML comments?+
Yes. Comments are kept and indented along with the surrounding markup.
Is the HTML sent anywhere?+
No. All work is done locally in the browser.