Skip to content
Expensico

HTML Formatter

Beautify HTML with consistent indentation using Prettier. Untangle messy markup from CMS exports, emails and minified pages, all in your browser.

Runs in your browser. Everything you enter stays on your device. Nothing is sent to a server.

How to use the HTML Formatter

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

How it formats

The formatter uses Prettier, the same tool many teams run in their editors. It parses the HTML (including inline <style> and <script>), then prints it with consistent indentation and wrapping. Because it parses first, badly broken markup produces an error with its location rather than mangled output.

Whitespace is respected

In HTML, spaces between inline elements can be visible. The formatter follows CSS display rules, so it won't add or remove spaces that would change how text renders — which is why some lines may look oddly broken around inline tags.

Preview safely

The formatter never executes your HTML. To see what a page looks like, use the HTML viewer, which renders it in a sandbox with scripts disabled.

Frequently asked questions

Can it minify HTML?

Not currently. Safe HTML minification has to respect whitespace-sensitive elements like <pre> and inline text, and we'd rather not offer a minifier that can subtly change your page.

Does it work with templates (JSX, Vue, Handlebars)?

Plain HTML only. Template syntax may cause parse errors.

Is what I enter stored or sent anywhere?

No. Calculations and processing happen in your browser. Nothing you type is sent to our servers. Some tools remember your last input in this browser's local storage for convenience; you can clear it at any time.