go-supertools
Developer & Data Tools

HTML Formatter

Format and indent HTML so it is easy to read.

Runs in your browser Your input never leaves your device.

About this tool

Paste HTML into the box and the tool re-indents it as you type, using the js-beautify library. Pick 2 or 4 spaces for the indent. Existing line breaks are preserved and long lines are not wrapped, so the output stays close to what you wrote while nesting becomes visible. It is a formatter, not a validator: it does not fix unclosed tags or report errors, and it will format whatever you give it. Everything runs in your browser, so your markup is never sent to our servers. Use Copy to take the result.

How to use it

  1. Paste your HTML into the input box.
  2. Choose an indent of 2 or 4 spaces.
  3. Read the formatted output, which updates as you type.
  4. Press Copy to use it.

Example

Input
<div><p>Hello <b>world</b></p><ul><li>One</li><li>Two</li></ul></div>
Result
<div>
  <p>Hello <b>world</b></p>
  <ul>
    <li>One</li>
    <li>Two</li>
  </ul>
</div>

Common problems

Broken markup is still formatted oddly
The tool does not repair HTML. Fix unclosed or mismatched tags first and the indentation will line up.
Inline elements stay on one line
Inline tags such as b, a and span are kept within their line on purpose so text does not change.
Extra blank lines remain
Line breaks you already had are preserved, including blank lines, so remove them yourself if you want a tighter result.