The Ideal W3 Total Cache Settings 2021 (With Cloudflare And BunnyCDN Instructions) — Updated With Latest Version 0.14.2

Looking for the best W3 Total Cache settings?

I generally don’t recommend W3 Total Cache since it doesn’t support database cleanup, heartbeat control, optimizing Google Fonts video optimization, or NGINX + memcached (only available with the premium version). While W3 Total Cache is free, WP Rocket is better since it has these built-in. That’s why it yields faster load times and is rated the #1 cache plugin in most Facebook polls. But if you insist on free, use this tutorial to set up your W3 Total Cache settings.

This tutorial shows you how to set up the performance tabs then add Cloudflare’s free CDN or BunnyCDN‘s premium CDN. Many W3 Total Cache settings are preset (shown in the “Install” tab), but not all of them. For hosting, I recommend DigitalOcean on Cloudways especially over SiteGround, EIG, and GoDaddy (TLDR: Cloudways + WP Rocket is a much faster configuration). They’re what I use; see my GTmetrix report or click through my posts to see how fast they load.

W3-total-cache-settings

 

W3 total cache dashboard

 

Download my recommended W3 Total Cache settings here (you’ll need a Dropbox account). Upload the file under Performance → General Settings → Import / Export Settings. Check your site to make sure everything is OK. You will still need to configure a CDN, activate extensions, and add your sitemap URL (under Page Cache). This file was last updated on March, 18, 2019.

 

1. General Settings

Important notes about the W3 Total Cache general settings:

  • Cache method: use disk enhanced for shared hosting, memcached for cloud hosting.
  • Database cache: leave disabled, it overloads the server especially on shared hosting.
  • Object cache: leave disabled, it will usually slow down the website and the dashboard.
  • CDN: enable if you plan on using BunnyCDN or another CDN (disable for Cloudflare).
  • Lazy loading: delays loading of images and fixes the lazy load item in PageSpeed Insights.
  • Fragment cache: only available with W3 Total Cache Pro and usually for dynamic sites.
  • Google PageSpeed Widget: I recommend the GTmetrix plugin for monitoring instead.

W3-total-cache-general-settings

 

2. Page Cache

Important notes about the W3 Total Cache page cache settings:

  • Don’t cache pages: you don’t want to cache pages for logged in users or user roles.
  • Rest API: the rest API can be disabled if you’re not using (check your website for errors).
  • Compatibility mode: enable, this is recommended in the Install tab by the developer.

W3 total cache page cache settings

 

3. Minify Settings

The plugin developer says the recommended settings for minify, database, and object cache are preset. You can find these recommendations in the Install tab. The main things to tweak are the browser cache settings and set up a content delivery network like Cloudflare or BunnyCDN.

Minify settings

 

4. Database Cache

  • Leave as is (recommended by the developer).

 

5. Object Cache

  • Leave as is (recommended by the developer).

 

6. Browser Cache

Important notes about the W3 Total Cache browser cache settings:

  • Enable first 6 settings: enable these individually and test the results in GTmetrix.
  • Brotli compression: if using Cloudflare’s CDN, enable this in the Cloudflare dashboard.

W3 total cache browser cache settings 1

Leave everything else including ‘expires header lifetime’ which the developer says is preset.

 

7. User Agent Groups

User Agent Groups are used to specify whether a mobile theme is used (if you have a mobile responsive website and are not using a plugin to create a mobile site, there is no need for this).

W3 total cache user agent groups

 

8. Referrer Groups

Referrer Groups are used to serve a unique cached version for users who come to your site through specific traffic sources (eg. Google or Bing). Most websites should leave this disabled.

W3 total cache referrer groups

 

Same concept as referrer groups, only it uses cookies instead to create a unique cached version for users who come to your site through specific cookies. Most sites should leave this disabled.

W3 total cache cookie groups

 

10. CDN

This section is specifically for CDNs who use a CDN URL (not Cloudflare).

I will be using BunnyCDN in the example which I also use on my site. It’s generally a higher performant CDN than StackPath and highly recommended in Facebook Groups. They have 50 data centers, easy setup instructions, and very affordable pricing. Cloudflare is fine for most sites, but if you’re looking to go the extra mile for faster speeds, you should try out BunnyCDN.

Bunnycdn network

Step 1: In the W3 Total Cache General Settings, enable Genetic Mirror.

W3-total-cache-enable-cdn

Step 2: Sign up for BunnyCDN (highly recommended in Facebook Groups and who I use).

Cdn comparison feedback

Step 3: Create a pull zone in BunnyCDN.

Bunnycdn add pull zone

Step 4: Copy your CDN URL from BunnyCDN.

Bunnycdn hostname

Step 5: Paste CDN URL in W3 Total Cache → CDN → Configuration Object → Hostname.

W3 total cache cdn url

Step 6: Configure the other CDN settings in W3 Total Cache.

W3-total-cache-cdn-settings

Step 7: In BunnyCDN, purge pull zone.

Bunnycdn purge pull zone

Step 8: Run your site in GTmetrix and “content delivery network” should be green in YSlow.

Cdn gtmetrix yslow

CDN pointers from the plugin developer (found in Install tab) – if you do not use the Media Library, import your images etc into the default locations. Use the Media Library Import Tool on the “CDN” tab to do this. If you do not have a CDN provider, you can still improve your site’s performance using the “Self-hosted” method. On your own server, create a subdomain and matching DNS Zone record; e.g. static.domain.com and configure FTP options on the “Content Delivery Network” tab. Be sure to FTP upload the appropriate files, using the upload buttons.

 

11. Fragment Cache

Fragment cache is mainly used in dynamic sites. Instead of caching an entire page, individual sections (usually the heavy areas) are cached. You will need to upgrade to W3 Total Cache Pro to use fragment cache. They have recommendations on that page I linked to which makes the plugin aware if you’re grouping transients. However, you may need some coding experience.

W3 total cache fragment cache

 

12. User Experience

W3 Total Cache comes with basic lazy load settings which fixes the lazy load item in PageSpeed Insights. This delays loading of images until you scroll down and see them. It doesn’t optimize videos, so if you embed YouTube videos on your site, you will need an additional plugin for that.

W3 total cache lazy loading

 

13. Extensions

Active any extensions you’re using. In my case it would be Cloudflare and Yoast.

W3 total cache extensions

 

14. Cloudflare CDN

Cloudflare is free with over 250+ data centers.

If you’re using Cloudflare, there is usually no need to use BunnyCDN. Unlike BunnyCDN, setting up Cloudflare is different and requires changing nameservers. When you’re done, be sure to login to Cloudflare’s dashboard and add Page Rules which can improve speed/security.

Cloudflare-bandwidth-savings

Step 1: Sign up for a free Cloudflare account, add your site, and run the scan prompted by Cloudflare. You will eventually come to a page where Cloudflare assigns you 2 nameservers.

Cloudflare-godaddy-nameservers

Step 2: Login to your domain registrar, find the area to change nameservers, and paste them here. Once this is done, you can go back to Cloudflare and click “Done, check nameservers.”

Siteground-dns-records

Step 3: In the W3 Total Cache Extensions tab, activate Cloudeflare and click Settings.

Cloudflare extension

Configure the Cloudflare settings (note: the only thing I changed is enabling hotlink protection).

W3 total cache cloudflare settings

Step 4: Login to your Cloudflare dashboard and go to Page Rules. Add these 3 page rules:

Page Rule 1: Cache Everything And Force HTTPS – cache your website aggressively.

https://*yourwebsite.com/*

Always-use-https-page-rule

Page Rule 2: Secure The WordPress Admin And Bypass Cache – sets security level of the admin to high and bypasses Cloudflare’s cache in the admin, since you don’t want CDNs (or apps + performance features like Rocket Loader) running inside the admin.

yourwebsite.com/wp-admin*

Wordpress-admin-page-rule

Page Rule 3: Decrease Bandwidth Of WP Uploads – since the content in your WP Uploads folder does not change frequently, increasing Edge Cache TTL to a month can save on bandwidth, since the WP Uploads folder cache won’t be refreshed as often.

yourwebsite.com/wp-content/uploads*

Wp-uploads-page-rule

Once you’re done configuring your CDN(s), purge all caches in W3 Total Cache. If you don’t see this, there may be an ’empty all caches’ option in the dashboard tab. It can take up to 24 hours for Cloudflare nameservers to propagate, but you will get a confirmation email once complete.

 

15. Hosting Recommendation: Cloudways Vultr HF / NameHero LiteSpeed

W3 Total Cache doesn’t fix a slow TTFB.

SiteGround has a slow TTFB, GoDaddy is a NO, Bluehost is gangrene, and stay away from Hostinger. Most hosting recommendations are garbage and I suggest joining the WP Speed Matters Facebook Group (run by Gijo Varghese) to get unbiased feedback on speed/hosting.

I use Cloudways Vultr HF which is a popular choice in Facebook Groups. You can check my GTmetrix report, TTFB, or click through my site to see yourself. I moved from SiteGround to Cloudways which cut load times in half and fixed CPU issues (it’s also monthly pricing with no higher renewals). They use Object Cache Pro/Redis with NVMe storage and 44 data centers. Main cons are no file manager/email hosting and their Breeze plugin + CloudwaysCDN aren’t great. I suggest WP Rocket/FlyingPress instead of W3TC, Cloudflare, and Google Workspace. They do 3-day trials, a free migration, and a promo code for 30% off 3 months. Some people are afraid they’re techie since it requires an extra step to launch a Vultr HF server, but it’s not hard:

Cloudways launch vultr hf server

Siteground slow ttfb

Siteground cloudways cpu usage

Siteground vs cloudways pricing

Spend 5 minutes looking at recent Facebook polls on “the best hosting,” migration results of people who switched, and unbiased feedback in Facebook groups (click thumbnails to enlarge).

Favorite-cloudways-server

Moving away from siteground

 
LiteSpeed hosting on NameHero is another solid choice (if you haven’t heard of LiteSpeed, go read about it). It’s cheaper than Cloudways because it’s shared hosting – but faster than most.

I’m not sure why people use other LiteSpeed hosts like Hostinger/A2 when you get more CPU cores + RAM with NVMe on NameHero. You can use the LiteSpeed Cache plugin with server-side caching, QUIC.cloud, HTTP/3, and Redis. This is arguably the fastest setup you’ll find on a budget. I don’t know anywhere else you get 3 CPU cores, 3GB RAM, and NVMe on LiteSpeed for $8/mo. WP Johnny and I both have solid guides on configuring LiteSpeed Cache with QUIC. The main con is they only have data centers in US + Netherlands. Otherwise they have higher uptimes with less ‘frequent maintenance’ compared to Hostinger/A2’s uptime status page with US-based support. Ryan (the founder) is a down to earth guy if you watch his YouTube channel.

Namehero plans resources
NameHero has more resources compared to similar LiteSpeed hosts (see specs page)

Web server poll

Web server poll oxygen

Siteground vs cloudways vs namehero

Namehero vs siteground feedback

Siteground to namehero

Cloudways trustpilot review

Namehero trustpilot review

Affiliate Disclaimer: I use affiliate links to Cloudways + NameHero and appreciate your support. But what do I know? I’m just a biased affiliate. Do your own research in FB groups.

 

Hire My WordPress Speed Optimizer

Still need help with your GTmetrix report? I’ve been working with Pronaya since 2011 (he’s the one who helped me get a such nice scores + load times. You can hire him by creating a profile on freelancer.com and searching for username bdkamol (see his portfolio). He’s $40/hour from Bangladesh (so there is a time change) and his email him is [email protected]. He has a perfect 5 star review on his profile. Serious inquiries only, and please don’t expect 100% scores if you’re using slow hosting, plugins, and theme. Please follow my WordPress speed guide first.

Bdkamol freelancer

 

Frequently Asked Questions

Is W3 Total Cache the best cache plugin?

Most people prefer WP Rocket over W3 Total Cache since it comes with features not included with W3 Total Cache, and therefore yields better results in GTmetix. These features include database cleanup, hosting analytics locally, advanced lazy loading of images + videos, heartbeat control, and DNS prefetching. It's also easier to configure.

Which CDN should I use with W3 Total Cache?

Yes, Cloudflare's free CDN is usually fine for most sites, otherwise use BunnyCDN which is highly recommended in Facebook Groups and consistently performant.

What happens if W3 Total Cache breaks my site?

The minification and combination settings in W3 Total Cache are usually the most common culprits of broken elements when using W3 Total Cache. Test each one of these carefully.

How do I clear cache in W3 Total Cache?

Go to the Performance settings and click Purge Everything.

Do I need other speed plugins besides W3 Total Cache?

Yes, you should also install plugins for heartbeat control, database cleanup, image optimization, and either Asset CleanUp or Perfmatters to selectively disable plugins.

See Also: My Full WordPress Speed Optimization Guide (25+ Tips)

That’s it! I know it can get a bit technical so if you have any questions just drop me a line in the comments. And if you enjoyed my tutorial, please give it a share. I would really appreciate that!

Cheers,
Tom

About Tom Dupuis

Tom Dupuis writes WordPress speed and SEO tutorials out of his apartment in Denver, Colorado. In his spare time, he plays Rocket League and watches murder documentaries. Read his bio to learn 50 random and disturbing things about him.

635 thoughts on “The Ideal W3 Total Cache Settings 2021 (With Cloudflare And BunnyCDN Instructions) — Updated With Latest Version 0.14.2

  1. Thank you so much for this great guide. Answered a ton of questions I’ve always had about W3 Total Cache. One quick question more… if I already have Cloudflare set up (with the W3 add on) do I also need to set up Stackpath option in General Settings in addition to Cloudflare? Or does Cloudflare already cover this?

    (I’m using the free version of Cloudflare)

    1. Nope, you only need to use 1 CDN. I always recommend checking cdnperf.com to see CDN speed/uptime performance. Cloudflare is alright and StackPath isn’t great which is why I usually recommend BunnyCDN.

      If using Cloudflare’s CDN, you’ll need to go to your DNS settings (in Cloudflare) and toggle your website from DNS Only to Proxied. If using something like StackPath/BunnyCDN, you will copy/paste the CDN URL into W3 Total Cache and make sure assets are being served from it.

  2. W3 total cache improves the SEO and user experience of your site by increasing website performance and reducing load times by leveraging features like content delivery network (CDN) integration and the latest best practices.

Leave a Reply

Your email address will not be published.