Toolstia / HTML beautifier
HTML beautifier
Paste HTML that is on one line or badly indented and get it back with tidy structure. Choose 2 or 4 spaces. Your code is not uploaded.
How it works
- Paste your HTML or press Use sample.
- Choose the indent size.
- Copy or download the result.
What it changes
It adds line breaks and indentation so nested elements are easy to follow. Your tags, attributes and text are not changed.
Inline CSS and JavaScript
Code inside style and script tags is formatted as well, so a whole page can be tidied in one go.
Whitespace in text
Spacing inside `pre` and `textarea` is preserved. In other places browsers treat extra whitespace as a single space, so formatting does not change how the page looks.
Why no HTML minify
Safe HTML minifying depends on how your page uses whitespace, so this tool only beautifies. Use the CSS and JavaScript minifiers for the code inside it.
Questions
Does it fix broken HTML?
No. It formats what you give it. Use an HTML validator to find structural errors.
Is it private?
Yes. Everything runs in your browser.
Can it handle a full page?
Yes, including head and body.
Does it change my text?
No. Only whitespace between tags is adjusted.