No tool matches “”

Try a format (“webp”, “mp3”) or a verb (“merge”, “compress”).

Loading index

↵to open

Developer Tools · Updated November 8, 2026 · Reviewed by FormatFlow Editorial

HTML Formatter & Minifier

You can format or minify HTML in your browser with the Prettier parser, choose two- or four-space indentation, and see parse errors with the line and column that caused them.

Runs in your browserFree · No sign-up · No watermark
HTMLRuns in your browser
Loading the tool…

Everything runs locally in this tab. No file is uploaded while the tool loads.

Use this tool as a step in a repeatable browser pipeline.

Add to Workflow

This tool runs in your tab. Nothing is uploaded and no copy is stored.

How files are handled

Key facts

Category
Developer Tools
Processing
In your browser — nothing is uploaded
Input formats
HTML
Output format
HTML
Maximum size
Bound by the memory available to your browser tab
Requirements
Chrome, Edge, Firefox or Safari · JavaScript enabled
Price
Free, no account, no watermark
Last updated
Nov 8, 2026

SummaryHTML Formatter is a free online developer tools tool. You can format or minify HTML in your browser with the Prettier parser, choose two- or four-space indentation, and see parse errors with the line and column that caused them. HTML that is written by hand, copied from a template engine or generated by a build step often ends up with inconsistent indentation and long lines. This formatter runs the document through the Prettier HTML parser, which understands nesting, void elements, inline content and raw-text elements, then prints it with the indentation you choose so the structure is easy to review. It runs in your browser — nothing is uploaded. It accepts HTML and produces HTML. The maximum size is bound by the memory available to your browser tab. Minify collapses whitespace between tags, so markup that depends on whitespace between inline elements can render differently.

At a glance

Formats
HTML → HTML
Processing
In your browser
Max size
Device memory bound
Price
Free, no account
Updated
November 8, 2026
All Developer Tools

About HTML Formatter

HTML that is written by hand, copied from a template engine or generated by a build step often ends up with inconsistent indentation and long lines. This formatter runs the document through the Prettier HTML parser, which understands nesting, void elements, inline content and raw-text elements, then prints it with the indentation you choose so the structure is easy to review.

Minify takes the opposite direction: it parses the document, removes comments and collapses whitespace between tags while keeping the content of pre, textarea, script and style blocks untouched. Both modes run in the browser and both refuse documents over 10 MB. When the HTML does not parse, the parser error is shown with its line and column instead of a generic failure.

What this tool does

The details that matter when you use HTML Formatter for real work.
  • Real HTML parser

    Formatting uses the Prettier HTML parser, so nesting, void elements and inline whitespace are handled by an established parser rather than a regex.

  • Two- or four-space indent

    Pick the indentation the project already uses; the setting applies to the formatted output and is remembered while you edit.

  • Minify without breaking content

    Minify removes comments and whitespace between tags, while the contents of pre, textarea, script and style are copied exactly.

  • Parser errors with position

    Invalid markup reports the parser message plus the line and column where parsing stopped, so the broken tag is easy to find.

  • Copy and download

    Copy the result or download it as an .html file, ready to paste back into a template or commit to the project.

  • Local and private

    Parsing, formatting and minification run in the browser tab; the document never leaves the device and no request is made.

How to use HTML Formatter

No account, no installation — the whole job happens in this browser tab.
  1. 01

    Paste or load HTML

    Paste the markup into the input pane or load a .html or .htm file from your device; files up to 10 MB are accepted.

  2. 02

    Choose the indentation

    Select two spaces or four spaces. The choice affects the formatted output only, never the text inside pre or script.

  3. 03

    Format or minify

    Press Format for readable nesting or Minify for a compact document. Both modes parse the HTML first and report errors before producing output.

  4. 04

    Check the result

    Read the output pane and the reported line count, and fix any parser error shown with its line and column.

  5. 05

    Copy or download

    Copy the HTML to the clipboard or download it as an .html file named after the uploaded document.

Supported formats and limits

Input
HTML
Output
HTML
Processing
Client-side, in your browser. Nothing is uploaded.
Maximum size
Bound by the memory available to your browser tab.
Requirements
Chrome, Edge, Firefox or Safari · JavaScript enabled

Limitations worth knowing

  • Minify collapses whitespace between tags, so markup that depends on whitespace between inline elements can render differently.
  • Comments are removed by Minify, including conditional comments; the original file is the place to keep them.
  • Embedded script and style contents are not minified, only the surrounding markup.
  • Input is capped at 10 MB and formatting runs on the main thread after a short yield.

Privacy and file handling

Your HTML is read, parsed and printed entirely inside this browser tab with Prettier loaded as a page script. The document is never uploaded to FormatFlow or anyone else, no copy is stored and nothing leaves your device; closing the page clears the input and the result.

Read the full privacy policy

HTML Formatter FAQ

Short, direct answers to the questions people ask before using this tool.
What does the formatter actually use?
It runs Prettier's HTML parser and printer inside the page. That gives format-aware indentation for elements, attributes, comments and inline content, instead of the naive indentation a regex-based formatter would produce.
What exactly does Minify remove?
Minify removes comments and collapses whitespace between tags, and it keeps a single space where text and inline elements need one. The contents of pre, textarea, script and style are copied byte for byte so their meaning does not change.
Why does my HTML fail to parse?
Common causes are an unclosed tag, a mismatched closing tag, a stray quote in an attribute or malformed markup inside a script block. The error message names the problem and includes the line and column where parsing stopped.
Are embedded scripts and styles reformatted?
Prettier formats embedded script and style contents with the matching parser when it can recognise them. Minify leaves those blocks untouched rather than running a second minifier over them, so their contents stay exactly as written.
Does the formatter preserve my comments?
Format keeps comments in the output where they belong. Minify removes comments, including conditional comments, so keep the original file when comments are documentation you still need.
Can formatting change how the page renders?
Formatting only changes indentation and line breaks in places the parser considers insignificant. Minify is more aggressive: because whitespace between tags is collapsed, markup that relies on whitespace between inline elements can render slightly differently. Check the output before shipping it.
Is my HTML uploaded anywhere?
No. The document is read locally, parsed by the Prettier plugin loaded into the page and printed in the browser tab. Nothing is uploaded, stored or logged, and closing the page discards the input and the result.
What are the HTML input limits?
Input is capped at 10 MB of HTML. Very large documents take longer because the parser and printer run in the tab, and minify keeps raw-text element contents untouched rather than minifying them.

Background reading

Format guides that explain the trade-offs behind HTML Formatter.