About html formatter / minifier
Formatting HTML indents tags so the structure is clear. Minifying removes unnecessary whitespace and comments to reduce page weight.
Format for editing, minify for delivery
Keep readable HTML in your project and minify during the build. Minified markup saves a small amount of bandwidth, but compression such as gzip or Brotli saves far more.
Careful with whitespace
Spaces between inline elements and inside pre tags can affect how a page renders. Check the result after minifying.
A worked example
A page pasted as one long line is re-indented so that nested elements line up, which makes a missing closing tag easy to find. Minifying does the opposite: it removes comments and collapses whitespace, often saving 10 to 20 percent of the size before compression.
Careful with
- Text inside <pre> and <textarea>, where whitespace matters.
- Spaces between inline elements, such as buttons next to each other.
- Conditional comments and inline scripts that rely on exact formatting.
