Zero Signup ToolsFree browser tools

Developer Tools

HTML Formatter

Format, beautify, and minify HTML in your browser. Configurable indent, attribute quote style, inline wrap, and document stats.

Mode

Pretty-print HTML with indentation and one tag per line.

0 chars / 0 B

Indent

Inline wrap

Inline-only blocks under this width stay on a single line.

Attribute quotes

Keep the quote style from the input.

0 chars
Load sample

HTML is parsed and rendered entirely in your browser. The markup you paste is never sent to a server.

Output

Paste HTML to format or minify. Output appears here automatically.

How to use

  1. Paste HTML into the input area on the left. Use Load sample to start with a working example (full page, form, table, card, or email markup).
  2. Pick a mode: Format to pretty-print with indentation, or Minify to collapse whitespace into the smallest payload.
  3. In Format mode, choose Indent (2 spaces, 4 spaces, or Tab), Inline wrap width (80, 100, 120 columns, or no limit), and Attribute quotes (preserve, double, or single).
  4. Read the formatted result on the right, copy it with Copy output, or click Replace with output to load it back into the input for another pass.
  5. Check the document stats panel to see element count, unique tag names, attribute count, max nesting depth, and comment count.

About this tool

HTML Formatter pretty-prints and minifies HTML directly in your browser, with the markup-preserving behavior real source code needs. Format mode lays the document out with one tag per line at the indent of your choice (2 spaces, 4 spaces, or a tab) and keeps inline-only blocks on a single line when they fit your wrap width (80, 100, or 120 columns), so paragraphs of inline tags like <strong>, <em>, <a>, and <span> stay readable instead of being shattered across many short lines. Minify mode collapses every whitespace run between elements into a single space and removes the spaces between sibling tags entirely, while keeping the contents of <script>, <style>, <pre>, <textarea>, and <title> intact because their whitespace is significant. The parser is purpose-built for HTML rather than XML, so void elements (br, img, hr, input, meta, link, and the rest of the HTML5 set) are recognized without requiring a slash, raw text bodies are not tokenized, attribute case and quote style are preserved in the output, and custom-element names like <my-card> survive a round trip exactly as written. The attribute-quote control rewrites every attribute to consistent double or single quotes when you need a uniform style, with automatic conflict-aware fallback so a value containing a quote does not get accidentally broken. Errors point to a line and column when the markup is structurally broken (a stray closing tag, an unterminated comment, an unclosed attribute), so you can fix the source quickly. The document-stats panel summarizes the parsed tree: element count, unique tag names, attribute count, max nesting depth, text-node count, and comment count, giving a quick X-ray of any snippet. Useful for tidying scraped HTML, prepping email templates, reviewing a server-rendered fragment in a pull request, shrinking inline HTML for production, or just turning a one-line minified blob into a readable document. Formatting and minifying happen entirely in your browser. The HTML you paste, including private templates and internal markup, never leaves your device.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools