---
title: Minify HTML
description: Learn how Minify HTML and HTML DOM Optimization in Powered Cache shrink your WordPress page markup, what they remove, and when to leave them off.
url: "https://poweredcache.com/docs/minify-html/"
updated: "2026-12-02"
category: File Optimization
---

# Minify HTML

Minify HTML removes unneeded whitespace from the HTML of your pages before they are sent and cached. Pages get a little smaller, so they download faster. The saving is usually modest, because most servers already compress HTML, but it costs nothing per visit once the page is cached.

**Available in:** Powered Cache (free)
**Where to find it:** Powered Cache → File Optimization → HTML

![](data:image/gif;base64,R0lGODdhAQABAPAAAP///wAAACwAAAAAAQABAEACAkQBADs=)

## How HTML minification works

Powered Cache minifies the finished HTML of each front-end page, right before it is sent to the browser. Because page caching stores that output, the cached copy is already minified and the work is done only once per page.

Only real HTML pages are processed. Powered Cache skips:

- The WordPress admin, the Customizer preview and REST API requests.
- Requests other than `GET`, and responses that are not HTML documents, such as XML sitemaps, feeds and `robots.txt`.
- The editing screens of Elementor, Divi, Beaver Builder, Bricks and Cornerstone, where all file optimizations are switched off.
- All requests while [Development Mode](/docs/development-mode/) is on.

## Turn on HTML minification

1. Go to **Powered Cache → File Optimization**.
2. In the **HTML** group, turn on **Minify HTML**.
3. Optionally turn on **HTML DOM Optimization** (*Optimize HTML output*).
4. Click **Save Settings**, then [clear the cache](/docs/clear-cache/) so cached pages are rebuilt with minified HTML.
5. Open a few pages in a private window and check that they look and work as before.

## Settings

### Minify HTML

Removes unnecessary whitespace from the generated HTML. **Default: off.** **Apply Recommended Settings** turns it on, unless Autoptimize, Perfmatters or PhastPress is active.

While HTML DOM Optimization is off, Powered Cache also removes the whitespace between tags and **all HTML comments** with a simple text pass. Turn on HTML DOM Optimization if a plugin or service relies on HTML comments in your page source.

### HTML DOM Optimization

Shown when Minify HTML is on. **Default: off.** **Apply Recommended Settings** turns it on together with Minify HTML.

With this option, the minifier reads the page as an HTML document instead of plain text, which makes its cleanup aware of the page structure. The simple text pass described above is skipped. It is the safer choice for most sites, so keep it on when you use Minify HTML.

## Caveats

- **Other optimization plugins:** when Autoptimize optimizes HTML too, Powered Cache shows a warning on this setting. Use HTML minification in one plugin only.
- **No per-page switch:** HTML minification applies to every front-end page. The editor panel has no option to turn it off for a single post.
- **Small gain:** if your server already sends pages with gzip or Brotli compression, minifying saves only a few kilobytes. It is still safe to keep on.

## Troubleshooting

### Spacing between inline elements changed

Some themes rely on the space between inline elements, such as buttons or menu items placed side by side. Turn on [HTML DOM Optimization](#html-dom-optimization), clear the cache and check again. If the problem stays, turn Minify HTML off. More checks are in [Broken layout after optimization](/docs/broken-layout-after-optimization/).

### Compare with the original page

To see a page without any Powered Cache processing, add `?nopoweredcache=1` to its URL. See [Bypass the cache](/docs/bypass-cache/).

## For developers

Return `true` from the `powered_cache_fo_disable_html_minify` filter to skip HTML minification for a request. See the [hooks reference](/docs/hooks-reference/).

## Related docs

- [Minify and combine CSS](/docs/minify-and-combine-css/)
- [Minify and combine JavaScript](/docs/minify-and-combine-javascript/)
- [Page caching](/docs/page-caching/)
- [Broken layout after optimization](/docs/broken-layout-after-optimization/)
