HTML Beautifier & Minifier

Format compressed HTML5 markup with void-tag awareness or minify HTML while preserving <pre>, <textarea>, <script>, and <style> blocks.

Private by architecture: All processing is 100% client-side memory. Your data never leaves this browser tab.
HTML input
0 lines · 0 charsHTML5
Formatted HTML
0 B

About This Tool

Indents compressed HTML5 markup into a readable hierarchy or minifies HTML by collapsing inter-tag whitespace and optionally removing comments.

Recognizes HTML5 void elements (img, input, br, hr, meta, link, source) so unclosed void tags never skew indentation, and protects raw whitespace inside <pre>, <textarea>, <script>, and <style> blocks.

Key Features

  • Whitespace-sensitive tag protection: Leaves exact newlines and spacing inside <pre>, <textarea>, <script>, and <style> untouched during both minification and formatting.
  • HTML5 void tag awareness: Handles <meta>, <link>, <img>, <input>, <br>, <hr>, and <source> without requiring XML self-closing slashes.
  • Optional comment stripping: Remove standard HTML comments (<!-- ... -->) while preserving IE/conditional comments when needed.
  • Configurable indentation: Format with 2 spaces, 4 spaces, or tabs, keeping short leaf elements on a single line.

Frequently Asked Questions

Will minifying HTML break <pre> code blocks or <textarea> default values?
No. All <pre>, <textarea>, <script>, and <style> blocks are stashed before whitespace collapsing and restored verbatim afterward.
Why do <img ...> and <input ...> not increase indentation depth?
In HTML5, void elements cannot have child nodes and do not take closing tags. The formatter checks the official HTML5 void tag set so subsequent sibling elements stay at the right indentation level.
Is my HTML document uploaded to any server?
No. Everything runs locally in your browser with zero network requests.