HTML Formatter
Indent nested elements cleanly while preformatted and script content stays verbatim.
Your HTML
Elements: —
How to use the HTML Formatter
- Paste the markup you want to re-indent.
- Choose a wrap width and tick the option to wrap long attribute lists.
- Click Format and copy the tidied HTML.
Features
- Nested elements indented two spaces per level
- Void elements such as br and img kept on one line
- Optional attribute wrapping at 80, 100 or 120 characters
- Pre, textarea, script and style content left verbatim
Advertisement
Frequently Asked Questions
Common questions about the free online html formatter.
It adds indentation so nested elements are easy to follow, and collapses runs of whitespace
between tags into a single space.
Whitespace and line breaks can be significant inside pre, textarea, script and style, so
those block contents are copied exactly.
Tags such as br, img, input, meta and link that never wrap content. They are written on a
single line with no closing tag.
When enabled, a tag whose attribute list is longer than the chosen width is split so each
attribute sits on its own indented line.
No. It only reformats whitespace. Broken nesting or invalid attributes are left for you to
correct in the source.
Yes. Partial markup and template fragments are formatted the same way, and unclosed tags are
still indented sensibly.
No. Formatting runs entirely in your browser, so your markup stays on your device.
Yes, the HTML formatter is completely free and unlimited, with no account required.
Last updated: October 10, 2026