HTML Prettifier Online
Transform compressed, minified or messy HTML into beautifully structured, readable markup. Indent nested elements with consistent spacing, align tag hierarchies and prepare code for review, debugging or documentation. Review formatted output before replacing your original file. Whitespace can be meaningful inside text nodes, so compare the rendered page as well as the indentation. Keep a copy of the original markup for comparison.
- Format messy HTML with proper indentation
- Preserve attributes, text content and void elements
- Choose 2-space or 4-space indentation depth
Paste and format HTML instantly
Drop your minified or messy HTML into the input area, select your preferred indentation level and click Format. Opening tags increase depth, closing tags decrease it.
Void element handling
Self-closing and void elements like br, img and input are formatted at their current depth without affecting the indentation of sibling elements.
Preserve content integrity
Tag attributes, text nodes, comments and CDATA sections are preserved exactly as they appear. Only whitespace and indentation around tags are modified.
Clean code for review and documentation
Properly indented HTML is easier to review in pull requests, share in documentation and debug in browser developer tools.
Technical references: HTML Reference