User Agents

Web browsers and everyday web tech, explained

How to Purge Your Cloudflare Cache (Fast & Easy)

· 4 min read · Cookies and Cache

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Purging your Cloudflare cache forces Cloudflare to fetch fresh content from your origin server and store it again. This is essential after updating your website's files, styles, images, or scripts, ensuring visitors see the latest version instead of stale cached data. Before you start, you'll need access to your Cloudflare account and the appropriate permissions for the domain you manage (usually Admin or Super Admin).

What You'll Need

  • Cloudflare account login credentials
  • Permission to manage the domain (Admin or Super Admin role)
  • Access to the domain's dashboard in Cloudflare

Step-by-Step

  1. Log in to your Cloudflare dashboard at dash.cloudflare.com.
  2. Select the domain (website) you want to purge from the drop-down menu at the top left.
  3. In the left sidebar, click on Caching (under the "Network" or "Speed" section, depending on your dashboard version).
  4. Click on the Configuration tab (if not already selected).
  5. Scroll down to the Purge Cache section. You'll see two options: Purge Everything and Custom Purge.
  6. To clear the entire cache for your domain, click the Purge Everything button. A confirmation dialog will appear.
  7. Read the warning and click Purge Everything again to confirm. This will clear all cached files for your domain.
  8. If you only want to purge specific files (e.g., a single image or page), choose Custom Purge instead.
  9. In the text area, enter the URLs of the files you want to purge (one per line). You can use the *.example.com/path/* format to purge a directory.
  10. Click the Purge button next to the text area to clear those specific files.
  11. After purging, verify that your changes are visible by visiting your site in an incognito/private browser window or using a cache-busting query string (e.g., ?v=2).

Common Mistakes

  • Purging everything unnecessarily: This can cause a temporary load spike on your origin server as it re-fetches all assets. Use custom purge when possible.
  • Forgetting to purge after updating files: If you update your CSS or JS but don't purge, visitors may see broken layouts or old functionality.
  • Using incorrect URLs in custom purge: URLs must match exactly (including protocol and trailing slashes) or the purge won't work. Double-check for typos.
  • Not waiting for propagation: Purging is usually instant, but CDN edge locations may take a few seconds to reflect the change. Don't panic if it's not immediate.

Tips

  • Use Cache Rules (available on Pro plans and above) to set specific caching behavior for certain paths, reducing the need for frequent purges.
  • For development, consider using a staging subdomain that bypasses caching or has a short cache TTL.
  • If you're using a build process, you can automate cache purging via the Cloudflare API after each deployment.
  • Always test your site after a purge to ensure everything loads correctly, especially if you've made major changes.

Troubleshooting

If the purge doesn't seem to work:

  • Check your browser cache: Your browser may still be showing a cached version. Clear your browser cache or use incognito mode.
  • Verify the purge was successful: In the Cloudflare dashboard, you should see a confirmation message. If not, try again.
  • Ensure you're purging the correct zone: If you have multiple domains, make sure you're on the right one.
  • Check for CDN caching at other layers: If you use another CDN or server-side caching (like Varnish), you may need to clear those as well.
  • Wait a few minutes: Occasionally, edge nodes take a bit longer to update. Wait 5-10 minutes and re-test.
  • Contact support: If the issue persists, reach out to Cloudflare support with your domain and the URLs you attempted to purge.

Frequently Asked Questions

Does purging the cache delete my files from Cloudflare's servers?

Yes, purging removes the cached copies from Cloudflare's edge network. The next time a visitor requests those files, Cloudflare will fetch fresh versions from your origin server.

How long does a purge take to take effect?

Typically, a purge is processed within seconds. However, it may take a few minutes for all edge locations to update globally.

Can I purge the cache automatically?

Yes, you can use the Cloudflare API to purge the cache programmatically, which is useful for automating deployments.

What is the difference between "Purge Everything" and "Custom Purge"?

"Purge Everything" clears all cached content for your domain. "Custom Purge" allows you to target specific URLs or file types, which is more efficient and less disruptive.

Will purging affect my website's performance?

Purging can cause a temporary performance dip as Cloudflare re-fetches content from your origin. This is usually brief and minor for most sites.

Do I need to purge after every update?

Not necessarily. If you use cache-busting techniques (like changing file names or adding version query strings), you may not need to purge. But if you update files in place, purging is recommended.