Looking for the best W3 Total Cache settings?
I’ll walk you through the setup guide, performance tabs, and show you why some CDNs are better than others (TLDR: I would personally use both Cloudflare + BunnyCDN). Many W3 Total Cache settings are recommended by the plugin developer in the Install tab, but not all of them.
I first published this guide in 2013 and have updated it several times. However, W3 Total Cache isn’t as popular as it once was since people started using other cache plugins like FlyingPress which do a better job of optimizing for web vitals. You can upgrade to W3 Total Cache Premium, but it still doesn’t do a great job compared to other cache plugins (and is expensive for $99/yr).
These W3 Total Cache settings are meant to be used as a starting point. You should ideally go through each individual setting and configure them for your own website.
1. Setup Guide
Before running the W3 Total Cache setup guide, make sure object cache (Redis or memcached) is activated in your hosting account. In cPanel, this is usually under Select PHP Version → PHP Extensions (or similar). Check your host’s documentation or Google instructions for your host. I prefer Redis which has advantages over memcached especially for larger/WooCommerce sites.
Once Redis or memcached is enabled in your host, open the setup guide and test page, database, and object cache. W3 Total Cache tells you which setting is fastest by showing the number with the highest percentage of savings (in green). That’s the setting you want to use.
Browser cache should be on:
Lazy load images should be on if you plan on using W3 Total Cache for this:
Once the setup guide is complete, you can configure the rest of the settings.
Once you set up Cloudflare (in the Extensions settings) and PageSpeed Insights (in the General settings), you can see their widgets here. Otherwise, most everything else are advertisements.
3. Feature Showcase
The only thing to do here is activate image service if you plan on using W3 Total Cache to compress images and using WebP. Many people also use a CDN (Cloudflare Polish or Bunny Optimizer), or a dedicated image optimization plugin. I prefer using a CDN, but it’s up to you.
4. General Settings
- Preview Mode: ON – test settings without breaking your live website. Click “preview” to see changes and “deploy” when you want to take them live. Disable it when you’re done.
- Page Cache: ON – reduce TTFB through page caching.
- Page Cache Method: TEST – use the setup guide to determine the best method.
- Minify: ON – reduces size of HTML, CSS, and JS by removing whitespace, but this can break your website. Configure all other minify settings below and in the main “minify” tab.
- Minify Mode: AUTO – if this breaks your website, change it to manual and add CSS/JS files in the Minify settings.
- Minify Cache Method: DISK – documentation says you should almost always use disk.
- HTML Minifier: MINIFY (DEFAULT) – has the biggest savings compared to HTML Tidy.
- JS/CSS Minifier: JSMIN (DEFAULT) + MINIFY (DEFAULT) – use the default in most cases.
- Opcode Cache: OPCODE: ZEND OPCACHE – you’ll need to enable this in your hosting account before selecting this, otherwise it will be grayed out (just like Redis/memcached).
- Database Cache: ON – object cache can add lots of database queries. This caches them.
- Database Cache Method: TEST – use the setup guide to determine the best method.
- Object Cache: TEST – this can slow down your website and admin, so test it carefully.
- Object Cache Method: TEST – use the setup guide to determine the best method.
- Browser Cache: ON – stores files in the user’s browser so they can be accessed faster.
- CDN: ON – only enable if you’re using a CDN that uses a CDN URL (i.e. BunnyCDN).
- CDN Type: GENETIC MIRROR – this is used for BunnyCDN which is what I recommend.
- Enable Reverse Proxy Caching Via Varnish – if using Varnish, add Varnish IP addresses.
- Lazy Load Images: ON – use W3 Total Cache to lazy load images.
- Disable Emoji: ON – if you use emojis, try Unicode which is faster.
- Disable wp-embed Script – converts links to embed frames (for example, pasting a Youtube link in the editor and the video will be shown). If you don’t need this, disable it.
- Disable jquery-migrate On The Front-end: TEST – disabling jQuery Migrate results in a slight performance increase but risks breaking your site. If you don’t need this, disable it.
- Fragment Cache Method: OFF – only on when using W3TC Premium’s fragment cache.
- License – used to add your W3 Total Cache Premium license key.
- Enable Google Page Speed Dashboard Widget: TEST – see PageSpeeds Insights results directly in your W3TC dashboard. You can get an API key here. I prefer going directly to the website and using tools like Chrome Dev Tools or core web vitals report in Search Console.
- Verify Rewrite Rules: ON – notifies you of server configuration errors (Rewrite Rules are found in the Install tab).
- Enable File Locking: OFF – incompatible with most shared hosts and usually not needed.
- Optimize Disk Enhanced Page And Minify Disk Caching For NFS: OFF – usually left off.
- Fix Document Root Path: OFF – unless the root path is misconfigured, leave it disabled.
- Anonymously Track Usage To Improve Product Quality: OFF – I always choose not to share data with plugins since it very slightly increases CPU usage, but it will be up to you.
- Debug Mode: OFF – unless you need to debug errors, you should leave these settings off.
5. Page Cache
- Cache Front Page: ON – caches the homepage which you obviously want to do.
- Cache Feeds: Site, Categories, Tags, Comments: ON – W3TC says to turn this on.
- Cache SSL (HTTPS) Requests: ON – enable this if using SSL which I’ll assume you are.
- Cache URIs With Query String Variables: OFF – unless your website uses query strings in URLs (?parameter=123 for example) and need them cached, you can leave this setting off.
- Cache 404 (Not Found) Pages: TEST – if you turn, make sure 404 pages actually return a 404, in which case it’s safe to enable. If 404 pages return a 200 response code, leave it off.
- Don’t Cache Pages For Logged In Users: ON – only turn this off if you run a membership website (or similar) where logged-in users need their own cached version. If you need this, you can also configure “Don’t cache pages for following user roles” to choose who sees it.
- Cache Alias Hostnames: OFF – only used to cache identify content on different domains in which case you will add “Additional Home URLs,” as well, but this is not recommended.
- Automatically Prime The Page Cache: TEST – artificially fills the cache so when users visit your site, they’re more likely to get a cache HIT. However, this can increase CPU usage so if you test it, enter the sitemap URL (i.e. https://example.com/sitemap_index.xml). You can increase the update interval or decrease the pages per interval if you’re getting CPU spikes. I would also recommend enabling preload the post cache upon publish events.
- Purge Policy: default settings are usually fine. After you publish a post, you’ll want to purge certain content (i.e. your blogroll) to make sure it shows new content. The default settings already purge the front page, post page, and blog feed which is usually enough.
- REST API: TEST – turn on and check your website for errors, otherwise leave it disabled.
- Advanced: these let you exclude certain parts of your website from the cache and configure other settings like specifying the lifetimes, but this isn’t needed in most cases.
6. Minify Settings
- Rewrite URL Structure: ON – leave enabled to use fancy links instead of GET variables.
- Disable Minify For Logged In Users: OFF – if you enabled caching for logged-in users and they’re having issues viewing the site, you can try turning it on. Otherwise, leave disabled.
- Minify Error Notification: ADMIN NOTIFICATION – if minify errors exist, you will get a notification in the admin (you can also change it to email or admin notification + email).
HTML Minify Settings: ON
- Inline CSS minification: ON
- Inline JS minification: ON
- Don’t minify feeds: ON – no need to minify RSS feeds).
- Line break removal: TEST – removing line breaks can lead to better performance but can break your site. I would turn it on, check for errors, and disable this if you see any.
- Ignored Comment stems: list of HTML comments that should ignore minification.
JS Minify Settings: ON
- Minify Method: MINIFY ONLY – you also have the option to combine (or combine & minify), but combining files is usually not recommended especially on larger websites.
- Minify Engine Settings: TEST – non-blocking settings will likely give you better scores but can break your site. It’s common to use non-blocking using “defer” before </head> and default (blocking) after <body>. If you have Minify Mode set to auto in the General settings, you will need to add JS and CSS files manually as well as in the correct order.
- Preserved comment removal: ON – removes comments from CSS to reduce file size.
- Line break removal: TEST – same suggestion for previous line break removal setting.
- HTTP/2 Push: TEST – can improve performance by pushing JS/CSS files to visitors faster (to avoid delays), but should be tested and must also be supported by your host.
CSS Minify Settings: ON
- Minify Method: MINIFY ONLY – same reason JS minify method is also minify only.
- Minify Engine Settings: see JS settings above for preserved comment removal and line break removal. You will need W3TC premium to eliminate render-blocking CSS.
- @import Handling: PROCESS– shown in the documentation and imports CSS file.
- HTTP/2 Push: TEST – same reason you should test HTTP/2 push in above JS setting.
- Advanced: if minify settings break your site, find problematic files and exclude them using these settings. You can also increase the number in “Update external files every” if CSS/JS files don’t change often, and decrease “Garbage collection interval” on higher traffic sites.
7. Database Cache
- Leave as is (recommended by the developer in the “Install” tab).
8. Object Cache
- Leave as is (recommended by the developer in the “Install” tab).
9. Browser Cache
- Set Last-Modified Header: ON – recommended in the documentation which has other tips for browser cache settings. I highly suggest you look through this documentation.
- Set Expires Header: turn this ON for all settings (General, CSS & JS, Media & Other Files), but leave it OFF for HTML & XML. W3TC says to only use it when there’s too much HTML traffic since it may result in users not seeing outdated content. Otherwise, this can fix the serve static assets with an efficient cache policy recommendation in PageSpeed Insights.
- Set Cache Control Header: ON – encourages browsers to cache files (suggested by W3TC).
- Set Entity Tag (ETag): ON – saves bandwidth by preventing 2 updates from overwriting each other when the responds to content that has not been changed (suggested by W3TC).
- Set W3 Total Cache Header: ON – assists W3 Total Cache in identifying optimized files.
- Enable HTTP (gzip/brotli) Compression: Brotli is faster than GZIP but you’ll need to make sure it’s enabled in your host or it will be grayed out. Use GZIP if Brotli is unavailable.
- Prevent Caching Of Objects After Settings Change: ON – forces browsers to reload assets when they’re updated and identify newly cached files (recommended by W3TC).
- Remove Query Strings From Static Resources: OFF – deprecated GTmetrix item you can leave off to make sure files are delivered correctly.
- Prevent Caching Exception List: leave blank unless you have query strings you want cached after settings change.
- Don’t Set Cookies For Static Files: ON – decreases upload and uncompressed traffic.
- Do Not Process 404 Errors For Static Objects With WordPress: OFF – while turning this on can slightly reduce server load, leaving it off ensures better compatibility with plugins.
- 404 Error Exception List: leave blank since the previous setting should be turned off.
- Rewrite URL Structure Of Objects: OFF – off unless there’s a specific reason to use it.
- Expires Header Lifetime: these should generally be left as the default number. Google suggests using 1 year (31536000 seconds) for static assets which is the default number.
- Security Headers: add and configure security headers which you can test in securityheaders.com. You could also use the HTTP Headers plugin which is much easier.
10. Cache Groups
User Agent Groups: 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).
Referrer Groups: 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.
This section is only for CDNs that use a CDN URL (not Cloudflare).
I suggest using both Cloudflare + BunnyCDN (also recommended by Gijo from WP Speed Matters). W3 Total Cache recommends StackPath but they have 30+ less PoPs and a slower Tbps when you compare the BunnyCDN’s network vs. StackPath’s. StackPath was also removed from cdnperf.com after having issues while BunnyCDN is both consistently performant and reliable. BunnyCDN is also highly recommended in Facebook Groups with their own setup instructions.
Step 1: In the W3 Total Cache General Settings, enable Genetic Mirror.
Step 2: Sign up for BunnyCDN. It costs $0.01/GB – $0.06/GB which is one of the cheaper (but better) CDNs. Add code OMM5 to your BunnyCDN Billing section if you want $5 in free credits.
Step 3: In your BunnyCDN dashboard, go to Pull Zones → Add Pull Zone. For name, enter your domain name as-is (no HTTPS, WWW, or .com). For origin URL, add your actual domain name. Then select the regions you want to use. Some are more expensive than others so if you don’t have users in South Africa, consider disabling that region. At the bottom, click “Add Pull Zone.”
Step 4: BunnyCDN will show your pull zone name + CDN Domain (you will need both of them). You can also choose to setup a custom CDN Domain which looks like this: cdn.yourwebsite.com
Step 5: Paste the CDN Domain in W3 Total Cache → CDN → Replace site’s hostname with. You shouldn’t need to change any other W3TC CDN settings, but feel free to go through them.
Step 6: Install the BunnyCDN plugin and add your pull zone name from step 4. This can help serve even more assets from BunnyCDN and was recommended to me by BunnyCDN’s support.
Step 7: Clear cache in W3 Total Cache and purge the pull zone.
Step 8: Make sure the correct files are being served from BunnyCDN.
12. Fragment Cache
Fragment cache is only available in W3 Total Cache premium.
This is specifically helpful for WooCommerce and dynamic websites. Fragment cache groups together different sections in your dynamic content so you can control how each one is cached.
13. User Experience
- Process HTML Image Tags: ON – you’ll want to process img tags for lazy loading.
- Process Background Images: ON – lazy load background images located in CSS files.
- Exclude Words: add all above the fold images here to exclude them from lazy load. This can improve LCP since lazy loading your above the fold images would be counterintuitive.
- Threshold: can result in a smoother scrolling experience by loading images before they get into the viewport using a threshold (i.e. 100px, 10%). This prevents lazy loaded images from “jumping” onto the page especially if you scroll down fast (bad for user experience).
- Script Embed Method: ASYNC – default setting is fine (larger sites shouldn’t use inline).
There are no settings here, but the developer shares tips and it also includes your rewrite rules.
Active any extensions you’re using (see sections below for Cloudflare + Image Service).
Once you’re done setting up Cloudflare, be sure to check out my full tutorial on the Cloudflare settings. Even the free plan has many features you can use to further improve speed + security.
Step 1: Sign up for Cloudflare and add your website.
Step 2: Change nameservers in your domain registrar.
Step 3: Proxy traffic through Cloudflare in the DNS settings to use their CDN.
Step 4: Activate the Cloudflare Extension in W3 Total Cache and click the settings.
Step 5: Enter your Cloudflare email, API key, and zone.
Step 6: Configure the W3 Total Cache Cloudflare settings (tips below).
- Set the cache level to aggressive for best results.
- I wouldn’t use Rocket Loader since if often breaks websites.
- Turn on Mirage if you’re using this Cloudflare service for image optimization.
- If you’re using W3 Total Cache to minify HTML/CSS/JS, turn them off in Cloudflare.
- Turn on email obfuscation to prevent spam if your email is shown on your site.
- Turn on hotlink protection to stop people from stealing images and using bandwidth.
- Turn TLS 1.2 Only to prevent people from accessing your site from older (slower) versions.
17. Image Optimization
You can use W3 Total Cache’s image service to compress images and serve them in WebP. However, I still recommend CDNs or a dedicated image optimization plugin since there are usually more settings and can sometimes better optimize your images. Your choice though.
Step 1: Activate the image service in the Extensions settings.
Step 2: Configure the settings (i.e. lossless compression, enable auto-convert).
Step 3: Manually convert images to WebP in the media library or bulk convert images in the previous setting. Free W3 Total Cache users only have a certain amount of conversions/month.
Hosting + CDN
I use Rocket.net with free Cloudflare Enterprise and average a <150ms global TTFB (or click through my pages to see how fast they load). Since TTFB is part of core web vitals and 40% of LCP, this has a large impact on core web vitals especially since combining a good host/CDN is arguably the best way to reduce TTFB. With Rocket.net, you’re really hitting 2 birds with 1 stone.
Just to give you an idea of their specs, all plans have 32 CPU + 128GB RAM, NVMe SSDs, Redis, and Cloudflare’s full page caching + Argo Smart Routing. They have no PHP worker limits (and 10-25 more monthly visits than Kinsta) since only about 10% of traffic hits your origin server thanks to their Cloudflare Enterprise. Ben Gabler is one of the smartest guys when it comes to performance, here’s my full review, and you can try them for $1. I used SiteGround, Cloudways Vultr HF, then Rocket.net. Each switch was a large improvement compared to the previous host.
|SiteGround||Kinsta||NameHero Turbo Cloud||Cloudways Vultr HF||Rocket.net|
|Hosting type||Shared||Cloud||Shared||Cloud||Private cloud|
|CPU cores||Not listed||12||3||1||32|
|RAM (GB)||Not listed||8||3||1||128|
|Object cache||Memcached||Redis ($100/mo)||Redis||Redis (Pro)||Redis|
|CDN||SiteGround CDN||Cloudflare Enterprise||QUIC.cloud||Cloudflare Enterprise ($5/mo)||Cloudflare Enterprise|
|Full page cache||✓||✓||✓||x||✓|
|Argo smart routing||x||x||x||✓||✓|
|CPU limits||Very common||PHP workers||Average||Average||None|
|Major incidents||Google blocked DNS for 4 days||None||2 day outage||None||None|
|Free migration||$30/site||Unlimited free||10 sites free||1 free||Unlimited free|
|Discount||None||None||Applied at checkout||30% off 3 months||$1 first month|
I switched from WP Rocket to FlyingPress and saw a big difference when clicking through my site. I was curious why it was so much faster, so I did a bunch of research and made this table.
|W3 Total Cache||WP Rocket||FlyingPress|
|Remove unused CSS||x||Inline||Separate file|
|Host fonts locally||x||x||✓|
|Preload critical images||x||x||✓|
|Fetchpriority resource hint||x||x||✓|
|Lazy render HTML elements||x||x||✓|
|Lazy load background images||✓||Inline||Helper class|
|Exclude above the fold images||By word||By URL||By number|
|Add missing image dimensions||x||✓||✓|
|YouTube iframe preview image||x||✓||✓|
|Self-host YouTube placeholder||x||x||✓|
I mainly use Perfmatters for asset unloading + bloat removal. But I would consider this a mandatory plugin if you’re still using WP Rocket since it addresses several lacking features.
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!