Format or remove whitespace between recognized block-level HTML elements without rewriting attributes or inline text.
This tool formats or removes whitespace-only gaps between recognized block-level HTML elements. It does not rewrite HTML attributes or ordinary text content.
Paste your HTML source code and select Format HTML. The tool inserts line breaks between adjacent recognized block-level elements to improve source readability.
Select Minify HTML to remove unnecessary whitespace-only gaps between recognized block-level elements. Other whitespace and text content remain unchanged.
Adjacent div, section and paragraph elements can receive line breaks. Spaces between inline span elements remain unchanged.
Content inside script, style, pre, textarea, title and other protected elements is preserved. Comments and attribute values are also retained.
This is a conservative whitespace formatter, not a complete HTML parser, validator or sanitizer. It does not automatically indent nested elements, remove comments, optimize attributes or repair malformed HTML. Always inspect the result before publishing.
HTML processing takes place locally in your browser. Your source code is not sent to an external formatting API.