How do I minify HTML, CSS and JavaScript to optimize my site?

Cloudflare users interested in minifying HTML, CSS and JavaScript can activate Auto Minify in their Cloudflare settings. Auto Minify will remove all unnecessary characters from HTML, JavaScript, and CSS files.

CSS & JS minification operates on cached CSS and JS files only. Once Cloudflare returns a cache HIT for the file it will be returned to browsers in minified form. This allows us to deliver a more complete minification result. If you need to enable or disable minification for CSS & JS you will now need to purge your Cloudflare cache to see the effect of any minification change.

The Auto Minify option can be found under the 'Speed' Section:

If you encounter any issues with Minification, check out our article that explains why Minification may not be working.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.