HTML Formatter
Pretty-print HTML with proper indentation and readability.
$html input
0 chars1 lines
$formatted[READY]
0 chars1 lines
Related Tools
FAQ
- Does the HTML formatter fix broken HTML?
- The formatter focuses on indentation and readability rather than correcting broken HTML structure. It works best with syntactically correct HTML. For broken HTML, use the HTML Validator first.
- Does it handle inline elements differently?
- Yes. Common inline elements like span, a, strong, em, code, and img are kept inline with their surrounding text. Block elements like div, p, section, and article get their own indented lines.
- Can I format HTML with embedded JavaScript or CSS?
- The formatter handles the HTML structure. Embedded script and style blocks are preserved as-is without additional formatting. Use the CSS Formatter separately for stylesheet content.
The HTML Formatter takes minified or poorly indented HTML and reformats it with consistent indentation, making it easy to read and edit. Uses a regex-based approach to handle nested tags, void elements, and inline elements. Ideal for cleaning up template output, inspecting HTML from web scraping, and code review.