Every WordPress page reaches the browser as HTML code. This code often has extra spaces, empty lines and hidden notes (HTML comments). Visitors never see them, but the browser still downloads them. Softminal Cache can remove them, so each page is a little smaller. This is called “minify HTML”.
What it changes
- Long runs of spaces and empty lines between tags become one space, or one line break.
- Hidden notes (HTML comments) are removed.
- Tags and their settings are copied exactly as they are. Only the text between tags gets shorter.
Some parts are never touched: code blocks, text boxes (textarea), scripts, styles and the page title. Comments that other tools read are also kept, like ESI, noindex and googleoff comments.
It runs last, after all other optimisations, on the finished page. If the page cannot be read safely, or the result is not smaller, the page is sent as it was. The cache stores the smaller page, so this work is done once per page, not on every visit.
Who should use it
Any site can use it. The gain is small, often a few kilobytes per page. The page cache, compression and images matter much more. So turn this on after those. It is not part of any profile, so you turn it on yourself.
How to turn it on
- Open Softminal Cache and go to the Optimize tab.
- Click CSS in the menu at the top of the tab.
- Scroll down to the HTML card.
- Turn on Make the page code smaller (minify HTML).
- Click Save changes. The cache is cleared, so the next visit gets the smaller page.
After you save, the self check loads your homepage and your latest post. If they fail to load, the change switches back by itself.
Is Autoptimize active? Then the switch is locked and the card says “Autoptimize already handles the page code, so this is left off here.” Only one plugin should do this job.
What can go wrong
May break: text with special spacing, like poems.
Code blocks and text boxes keep their spaces. But some themes keep spacing through their CSS, for example for poems or song lyrics. There, several spaces become one, and line breaks may change. If you see this:
- Put that text in a Preformatted or Code block. These are always kept.
- Or turn the switch off again and click Save changes.
- Or click Undo in the top bar. It works for 24 hours after a change.
- Not sure what causes a problem? Turn on Safe Mode. It pauses all optimisations, but the page cache keeps working.
How to check it works
Open a page in a private window, so you are logged out. Right click and choose View page source. The code has fewer empty lines, and the HTML comments are gone.
Want smaller style files too? See CSS: minify.