Code / Code formatting

HTML Formatter

Format and clean up HTML markup in seconds.

Workspace

Browser-based

How to use HTML Formatter

Use consistent indentation and whitespace in HTML documents and fragments for easier review and maintenance.

  1. Paste HTML markup into the source editor.
  2. Select Format code.
  3. Review the normalized markup and copy it.

Example

Input

<main><h1>Hello</h1></main>

Result

<main>\n  <h1>Hello</h1>\n</main>

Important to know

The formatter follows HTML syntax and may normalize whitespace or quote styles. Check rendered output when whitespace-sensitive markup is involved.