Learn about issues with Auto Minify.
Why isn't Auto Minify working?
Once enabled, Cloudflare's Auto Minify will minify your HTML and your cached CSS and JS files. If you view the source of your files in your web browser or via a command line tool (such as cURL) and you do not see the code being minified, here are some things you should check:
- Only files that are served via your orange-clouded DNS records will be minified — this means that code on third-party domains that are not using Cloudflare will not be minified.
- For CSS and JS only a cache
HITwill be minified — refer to Default Cache Behavior to check an individual file's cache status.
- The feature will deliberately skip minification for JS/CSS files with
.minin the name.
- If your code has fatal syntax errors, Auto Minify may not be able to successfully minify the code — use syntax checkers (such as the ones recommended in this article) on your files to confirm this.
- We will not minify inline JS/CSS inside your HTML.
- We do not remove HTML comments by default. However, HTML Minification does remove comments like
<!-- This is a comment —>. As a result, any tool or program relying on HTML comment might not work as expected. That is the case, for example, with the FacetWP WordPress plugin. In this case, the Auto Minify feature needs to be disabled for the HTML. This can be done by logging in to the Cloudflare dashboard, and selecting your account and website. Then, go to the Speed app > Optimization tab. Auto Minify can also be disabled on specific URLs using a Page Rule.
If you want to manually confirm whether your files are getting minified, you can use a tool such as
cURL to compare the response with and without Cloudflare — refer to Gathering information for troubleshooting sites to learn how to do that or you can view the source code in your browser directly.
To check the syntax of your HTML / CSS or JS files we recommend using online validators / tools such as the following to look for potential issues:
If you see that minification still is not taking effect after checking these steps, please contact Cloudflare Support. You should include the URLs of the resources that you are seeing issues with.