Skip to main content
GARGLOO

HTML Formatter Online – Beautify HTML Free

Readable HTML, exact errors.

Runs on your deviceHTML

At a glance

Input:
HTML
Processing:
Runs locally in your browser
Privacy:
Nothing you type is sent to a server

Last updated: 2026-11-13

Common use cases

  • Untangling a minified page or email template into readable markup
  • Checking a pasted snippet for mismatched or unclosed tags before shipping it
  • Shrinking an HTML file before deploying it
  • Comparing what formatting actually changes, rule by rule

About this tool

A fast, private HTML formatter that indents messy markup, minifies it on demand, and reports mismatched or unclosed tags with the exact line and column — with script, style and pre content copied verbatim, never re-indented.

How to use it

  1. Paste HTML into the editor.
  2. Pick Format or Minify — and the indent for Format (⌘/Ctrl+Enter works too).
  3. Read the result, or the exact line and column of the first error.
  4. Copy the result or download as .html.

Worked examples

Input: <div><p>Hello</p></div>

Output: <div> <p>Hello</p> </div>

The headline example: 3 lines at 2-space indent — verified.

Input: <ul><li>One</li><li>Two</li></ul>

Output: <ul> <li>One</li> <li>Two</li> </ul>

Nested lists indent one level per element.

Input: <div> <p>Hello</p> </div>

Output: <div><p>Hello</p></div>

Minify mode: the same document squeezed to one line — verified.

Practical tips

  • Use Ctrl/⌘+Enter to re-run after each fix — the shortcut keeps hands on the keyboard.
  • Format first, minify last: debug the readable version, ship the small one.
  • A trailing slash on a non-void element (<div/>) does not close it in HTML — write a matching </div>.

Common mistakes

  • Pasting HTML with a mismatched close tag — the error names the exact line and column of the '</div>'.
  • Expecting formatting to fix broken HTML: it only re-indents valid markup, it never repairs it.
  • Re-indenting <pre> by hand: its spaces are content — this tool copies them verbatim for a reason.

How this compares

Most HTML formatters in the field are server-side paste bins that upload your markup, or thin wrappers that re-indent without checking anything. This one formats locally with no upload, reports mismatched and unclosed tags with exact line numbers, and never touches script, style or pre contents. The tradeoff: no Prettier and no inline CSS/JS formatting — the formatter indents HTML structure only.

Good to know

  • Formatting is not validation — a <li> outside a <ul> formats fine; the tool only reports mismatched and unclosed tags.
  • Script, style, pre, textarea and title contents are copied verbatim, so their inner indentation is yours, not the formatter's.
  • The 1,000,000-character cap keeps huge documents responsive; split larger files before pasting.

Frequently asked questions

Does formatting send my HTML anywhere?

No. Formatting runs entirely in your browser — safe even for markup with internal hostnames or tokens in comments you'd rather not leak.

What happens to <script>, <style> and <pre>?

Their contents are copied verbatim and never re-indented — JavaScript, CSS and preformatted text keep every space and newline exactly as pasted.

What counts as an error?

Mismatched close tags, unclosed tags, unclosed comments and unclosed attribute values — each reported with the exact line and column. A <li> outside a <ul> still formats fine: formatting is not validation, it only fixes indentation.

How much smaller does minify make HTML?

The sample on this page goes from 365 messy characters to 336 minified — 7.9% smaller — and the formatted version (465 characters) minifies 27.7% smaller. Real pages typically save 10–25%; already-minified HTML barely shrinks further, which is expected.

How large can input be?

Up to 1,000,000 characters. Anything malformed is reported with the exact line and column instead of producing a broken file.

All developer tools
HTML Formatter Online – Beautify HTML Free | GARGLOO