toolgix

HTML Formatter

Beautify messy or minified HTML, including the CSS and JavaScript inside it.

Runs in your browserFree · no sign-up
01 HTML
02 Formatted HTML
OPT Options

How to use HTML Formatter

  1. Paste HTML or open a file.
  2. Choose indentation and line width.
  3. Copy or download the formatted HTML.

How it works

Formatting is done by Prettier, the open-source formatter used by a large share of web projects, running in your browser. It parses the HTML, then prints it with consistent indentation and line breaks. <style> blocks are formatted as CSS and <script> blocks as JavaScript.

Whitespace in HTML can be visible: a line break between two inline elements renders as a space. With Respect inline elements, Prettier never adds or removes whitespace where that would change how the page looks, which sometimes produces unusual-looking line breaks inside tags. Ignore gives the tidiest layout but can add or remove spaces between inline elements.

Everything runs in your browser. The text you paste is not uploaded, logged or saved, so configuration files, API responses and customer data stay on your device.

Example

<div><p>Hello</p><ul><li>One</li></ul></div> becomes a properly nested, indented block of five lines.

Frequently asked questions

Will formatting change how my page looks?

Not with the default whitespace setting, which preserves meaningful spaces. "Ignore" can change spacing between inline elements such as links and spans.

Does it fix invalid HTML?

It formats what the parser understands and reports errors such as an unclosed tag in a place where HTML does not allow it. It is not a validator.

Does it format the CSS and JavaScript inside?

Yes, <style> and <script> contents are formatted too.

Can it format Vue, JSX or PHP templates?

Vue single-file components mostly work as HTML. JSX belongs in the JavaScript formatter. PHP and other server templates are not supported.

Limitations

  • Not a validator: it does not check accessibility or standards conformance.
  • Server-side template syntax (PHP, Jinja, ERB) may be rejected or left unformatted.
  • The first use downloads the formatter (about 1 MB).

Last reviewed November 9, 2026. How we build and test tools.

Categories

Recent and favourites

Tools you open appear here, and tools you star with “Favourite” stay at the top. This list is kept only in this browser.

Browse all 145 tools

↑ ↓ to moveEnter to openEsc to close