Skip to content
Popular tools

HTML Formatter

Format HTML markup.

LocalYour data is processed locally in your browser and is not uploaded to Alphzen.

Paste source to format.

How to use

  1. Paste HTML or a fragment.
  2. Format. Tags indent; script/style/pre/textarea bodies are left intact.
  3. Copy the result. Markup is not rendered as a live page.

Features

  • Does not use innerHTML, so scripts in the input are not executed.
  • Knows void elements (br, img, input, …).
  • Keeps raw text in script, style, pre, and textarea.
  • Preserves comments and doctype.
  • Local processing only.

Examples

Nested fragment
<div><p>Hello <strong>Ada</strong></p></div>

FAQ

Is the output injected into the page?

No. You see formatted source in a text box. That is the point of a formatter versus a previewer.

Will this fix invalid HTML?

No. It indents tokens. It does not run a browser parse-and-repair cycle, which would rewrite your fragment.

What about SVG or JSX?

SVG usually formats. JSX is not HTML; self-closing components may still indent, but this is not a JSX printer.

Related guides

Related tools

About this tool

Readable HTML is indented tags, not a live preview. Alphzen formats source without executing it, which matters when the snippet is untrusted.

Void tags do not get false closing partners. Raw-text elements keep their interior so CSS and JS are not re-wrapped as HTML.

For entity escaping use HTML Entity Encoder. For stylesheets use CSS Formatter.