Content inside <pre>, <script>, and <style> tags is preserved exactly as written — it is never re-indented or treated as markup to format.
Format or minify HTML while preserving pre/script/style content.
Content inside <pre>, <script>, and <style> tags is preserved exactly as written — it is never re-indented or treated as markup to format.
Pretty-print or minify HTML markup while correctly preserving the exact content of <pre>, <script>, and <style> tags. Malformed or unclosed tags are handled gracefully instead of crashing the formatter.
This formatter deliberately doesn't hand your markup to the browser's built-in HTML parser. The DOM parser is extremely forgiving — it silently closes unclosed tags, reorders misplaced elements, and 'fixes' things in ways that would hide the actual structure of what you pasted. Instead, this tool tokenizes your HTML linearly and tracks a tag stack itself, so malformed or unclosed tags degrade gracefully instead of being invisibly repaired.
The content of <pre>, <script>, and <style> elements is captured verbatim the moment their opening tag is seen, up to their matching closing tag, and is never re-indented or reformatted — which matters because whitespace inside <pre> is meaningful, and reformatting JavaScript or CSS as if it were markup would corrupt it. Minification follows the same rule: those elements are copied through byte-for-byte while surrounding markup has its whitespace collapsed and comments removed.