HTML Beautifier & Minifier
Format compressed HTML5 markup with void-tag awareness or minify HTML while preserving <pre>, <textarea>, <script>, and <style> blocks.
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.