← All Tools

HTML Beautifier🔒 100% local

Format and indent HTML code for readability. Configurable indent size.

Indent Size (spaces)
HTML Input

HTML Beautifier: related tools

HTML EncoderHTML DecoderHTML to JSX

Re-indents HTML by splitting the input on tag boundaries and printing every token on its own line, increasing the indent level for each opening tag that is not a void element such as img, br or input. You choose an indent of 1 to 8 spaces. It is a tokenizer rather than a parser: no DOM is built, nothing is validated, and the markup is never rendered or sent.

HTML Beautifier: how to use it

  1. Set the indent size. Two spaces is the default.
  2. Paste the markup into the box.
  3. Press Beautify, then Copy Output.

HTML Beautifier: worked example

<div><span>Hello</span><p>World</p></div> with indent 2becomes<div> <span> Hello </span> <p> World </p> </div>
<img src="a.png"><br><p>Hi</p>becomes<img src="a.png"> <br> <p> Hi </p>

img and br are on the void-element list, so they do not push the level down and the p starts back at column 0.

HTML Beautifier: when to use it

HTML Beautifier: what it does not do