Skip to content
Convertto

HTML Formatter

Format and indent HTML properly, preserving inline elements and whitespace sensitivity.

To format HTML, paste your markup and it is re-indented with proper nesting. Prettier understands which elements are whitespace-sensitive, so it will not insert line breaks that would visibly change how inline elements such as span and a are rendered.

Runs in your browser
Privacy
Runs entirely in your browser — nothing is uploaded
Cost
Free, unlimited, no sign-up

Frequently asked questions

Why did some tags stay on one line?

HTML treats whitespace between inline elements as meaningful. Prettier deliberately avoids breaking those lines because adding a newline would introduce a visible space in the rendered page.

How to use the html formatter

  1. 1Enter or paste your html.
  2. 2Set the line width.
  3. 3Set the indent size.
  4. 4Turn "Indent with tabs" on or off as needed.
  5. 5The result appears immediately — copy or download it.

Embed this tool

Put the working html formatter on your own site. It runs in your visitors' browsers exactly as it does here — free, no account, nothing uploaded.

Share this tool

Last updated

More data & format tools