HTML Formatter and Minifier
Make messy HTML readable with consistent indentation, or minify it for production — without breaking preformatted text, scripts or inline spacing.
Result
Paste HTML to format or minify.
How to use this tool
- Paste HTML and choose Format or Minify.
- Choose indentation and whether to keep comments.
How it works
The HTML is split into tags, text, comments and raw blocks. Block elements get their own indented lines; inline elements such as <b> and <a> stay within their text. <pre> and <textarea> content is kept exactly.
Example
Formatting
<div><p>Hello <b>world</b></p><ul><li>One</li></ul></div> becomes an indented tree with <p>Hello <b>world</b></p> on one line.
Privacy and limitations
- Everything runs in your browser; nothing you enter is uploaded or stored.
- The formatter tidies markup; it does not validate it.
Frequently asked questions
Will minifying change how my page looks?
It removes whitespace between block elements and keeps spaces next to inline elements, so text should not run together.
Are scripts minified?
No — script and style contents are kept as they are.