Introduction
HTML minification is the process of removing unnecessary or redundant data from HTML code without affecting the browser's handling of the resource - for example, code comments and formatting, removing unused code, using variable names and shorter functions, etc.
When developers write code, they include line breaks, spaces, and comments to make the code easier to read, but your browser doesn't need to process it. So minification removes these elements. This will make the code virtually unreadable to humans, but computers don't care, they can still process it. White space is for us weak humanoids :). These useless parts add a few more bytes to the file size, making them larger than necessary.
Example
Without HTML minification
With HTML minification
Settings
keepcomment
This option keeps HTML comments in the code. Experience has shown us that removing HTML comments implies recurring bugs.
As the impact of such optimization is low, we have decided to disable this optimization by default.
WebPerf Impact
The expected impact is a reduction in the size of the HTML file. It is therefore downloaded more quickly by the browser. To a lesser extent, this also reduces parsing and execution time.
This optimization is basic and risk-free. It is a complement to gzip or brotli compression.
How to check it is working?
The HTML code of your page will no longer contain line breaks after activating HTML minification.
Dashboard Activation
API Activation
Recommendation
We advise you to activate this optimization systematically.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article