100% offline
Developer
Free · no signup
Updated

HTML Formatter

An HTML Formatter re-indents minified or messy HTML into readable markup using Prettier's own engine in your browser, formatting embedded <style> and <script> blocks at the same time.

HTML input0 lines · 0 B
Formatted0 lines · 0 B
(formatted output appears here)

About HTML Formatter

Paste minified or hand-mangled HTML and get it back properly indented, with attributes wrapped sensibly and inline CSS and JavaScript formatted too — most online beautifiers leave embedded blocks as one long line. This runs the real Prettier engine, self-hosted and bundled with the page rather than loaded from a CDN, so the output matches what your editor would produce and your markup never leaves the tab. If the document won't parse you get the exact line and column instead of silently mangled output.

What HTML Formatter does

  • Runs the real Prettier engine, self-hosted — no CDN
  • Formats embedded <style> and <script> blocks too
  • Whitespace sensitivity modes: CSS-aware, strict, ignore
  • Optional one-attribute-per-line for long tags
  • Exact line and column on a parse error
  • Indent width or tabs, plus configurable wrap column

When to reach for HTML Formatter

  • Reading a minified page you saved or inspected
  • Cleaning up exported or generated markup
  • Making an email or CMS template reviewable in a diff
  • Normalising indentation before committing a template

How to use HTML Formatter

  1. 01

    Paste your HTML

    Paste minified or messy markup into the input pane.

  2. 02

    Adjust options

    Set indentation, wrap column, and whitespace sensitivity.

  3. 03

    Copy or download

    Copy the formatted markup or download it as a file.

When to use HTML Formatter vs alternatives

AlternativeUse HTML Formatter when…Use the alternative when…
Your editor's format-on-saveyou're on a borrowed or locked-down machine, or the snippet isn't in a project yet.the file already lives in a repo you have open.
A generic online beautifieryou want Prettier's canonical output, embedded CSS/JS formatted, and no upload.you need a legacy indentation style Prettier doesn't offer.

Frequently asked questions

Does this upload my HTML?
No. Prettier is bundled with this page and runs inside your browser tab. Open DevTools and you'll see no request carrying your markup — the only network activity is fetching the formatter code itself the first time.
Will it format inline CSS and JavaScript?
Yes. The HTML parser is loaded together with the CSS and JavaScript parsers, so <style> and <script> contents are formatted in place rather than left as a single line.
What does whitespace sensitivity change?
CSS-aware (the default) respects each element's default display value so the formatter never introduces whitespace that would visibly move inline elements. Strict treats all whitespace as significant, and Ignore lets the formatter reflow freely — handy for machine-generated markup.
Why did I get a parse error instead of output?
Prettier has to build a syntax tree before it can print, so genuinely malformed markup stops it. The error shows the line and column so you can fix the tag rather than receiving quietly mangled HTML.