Skip to main content
Back to Tools
Web Tools

HTML Minifier/Beautifier

Beautify or minify HTML with configurable indentation, comment handling, and optional tag removal. Supports all standard HTML elements including void elements, raw text elements, and CDATA. Runs entirely in your browser — your data never leaves your machine.

html minifier beautifier formatter code-formatter

Published May 28, 2026

All interactive tools run entirely in your browser. Your data never leaves your device.

How It Works

Paste HTML code and choose between beautify (pretty-print) or minify mode. The tool tokenizes the HTML, identifies tags, comments, and text content, then arranges them with proper indentation or compresses them into minimal output.

Features

  • Beautify mode: proper indentation with configurable indent size (2 or 4 spaces)
  • Minify mode: whitespace removal, comment stripping, optional closing tag removal
  • Comment handling: preserve or remove HTML comments in both modes
  • Void elements: correctly handles self-closing elements (br, hr, img, input, etc.)
  • Raw text elements: preserves script, style, textarea, and pre content
  • CDATA sections: preserves CDATA blocks
  • Inline elements: smart indentation that keeps inline elements compact
  • Optional tags: optionally remove closing tags for li, p, td, th, etc.
  • Statistics: input/output size, savings, tag count, comment count
  • 5 example templates: basic page, nested list, form, table, commented markup
  • Private: runs entirely in the browser — no data transmitted

Use Cases

  • Formatting minified HTML for readability and debugging
  • Minifying HTML for production deployment
  • Cleaning up messy HTML from CMS output or email templates
  • Comparing HTML structure before and after changes