HTML Formatter & Beautifier

Paste HTML and press “Format HTML” to tidy it with Prettier’s rules.

Your text and files never leave your browser — nothing is sent to a server.

How to use

  1. Paste your HTML and press “Format HTML”. The first run may take a moment while the formatter downloads.
  2. Set “Indent” and “Line width”. Lines longer than the width are wrapped by moving attributes or content onto new lines.
  3. The default whitespace mode protects spaces around inline elements so the page looks the same. “Ignore whitespace” is tidier but may change the spacing between words.
  4. If tags do not match, the line and column of the problem are shown. For a deeper structure check, try the HTML Validator.

FAQ

Which formatting rules are used?

The tool runs Prettier, the widely used open-source formatter (MIT license), directly in your browser, so the result is essentially what Prettier gives you in your editor.

Will formatting change how the page looks?

With the default setting, whitespace is handled so the rendered page stays the same, which is why tags sometimes break across lines oddly. “Ignore whitespace” looks cleaner but can change the spacing between inline elements.

Is my code sent to a server?

No. Even the formatter itself is downloaded to your browser, and everything is processed on your device.

Related tools

All tools