Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

What is: Cache

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

In WordPress, a cache saves a copy of each page on a website the first time it is loaded and serves those files to repeat visitors. This can improve WordPress speed and performance by speeding up loading times.

Most web browsers also use caching to speed up your browsing. They cache recently viewed files on your computer. This means that if you revisit a web page, then the browser can display the files already stored on your computer rather than needing to download them again.

Browsers can also cache DNS information to speed up navigation to frequently visited websites.

Glossary: Cache

You can use the links below to learn about the different types of caches:

What Is a WordPress Cache?

A WordPress cache stores a temporary copy of your website content. This reduces the load on your WordPress hosting servers and makes your website run faster.

Caching can make your WordPress website 2-5 times faster. But how does this work?

How Does Caching Improve WordPress Performance?

WordPress pages are dynamic, and this means that they need to be built on the fly every time someone visits them. This uses a lot of server resources and slows down loading times.

This process involves a lot of steps, such as running PHP scripts, retrieving content from a MySQL database, and more. WordPress uses this to generate the HTML content that visitors see.

You can learn more in our guide on how WordPress actually works behind the scenes.

How a WordPress Cache Works

So, how does WordPress caching speed up your website? Instead of dynamically generating HTML content each time, a copy of the page is saved to the cache after the first load. Repeat visitors will then see the pre-built page, which is much faster than generating it from scratch.

How to Add Caching to Your WordPress Website

You can set up caching on your website using a good WordPress caching plugin such as WP Rocket.

Alternatively, many WordPress hosting companies like Bluehost and SiteGround offer built-in caching solutions

How to Clear Your WordPress Cache

As you update your content, the pages in your WordPress cache may become out of date. This means that your visitors will not be seeing the most recent version of your content.

Caching plugins handle this by giving you control over when the cache expires, when it is cleaned up, and more.

However, there may be times when you wish to manually clear your WordPress cache to make sure that your visitors are seeing your latest updates.

Clearing the WordPress Cache in WP Rocket

You’ll find instructions for popular caching plugins and hosting providers in our guide on how to clear your cache in WordPress.

What Is a Browser Cache?

A browser cache is used by most modern web browsers to speed up page loading even further. When you visit a web page, it will save the static content, such as images and stylesheets, on your computer.

The next time you visit the web page, those files will be quickly loaded from your computer instead of being downloaded from the web server, which is slower.

How to Control the Browser Cache With Expires Headers

Like the WordPress cache, the files in your browser cache can become outdated. That’s why your browser will refresh the contents from time to time.

As a website owner, you can control how often your website data will be refreshed by the browser. You achieve this by adding expires headers to your .htaccess file.

Expires headers are rules that set an expiration date for each type of file stored in the browser cache, like this:

## EXPIRES HEADER CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/svg "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 3 days"
</IfModule>
## EXPIRES HEADER CACHING ##

Once the files expire, they will be reloaded from your server to give visitors the most recent version of the page.

How to Clear the Browser Cache

Users can also clear their browser cache for troubleshooting purposes or if they want to make sure they are seeing the most recent version of a website.

We offer step-by-step instructions in our guide on how to clear your browser cache in all major browsers.

Clearing the Browser Cache in Google Chrome

What Is a DNS Cache?

DNS stands for Domain Name Server, and it is like an address book that contains the IP address associated with each website on the internet. You can learn more about DNS in our guide on how domain names work.

When you type in a website address like www.google.com, your web browser needs that site’s IP address so that it can direct you to the webpage you are looking for. To find this IP address, the browser must access an online DNS server.

How DNS Works

Once your browser knows the IP address for a domain name, it saves that information in a local DNS cache on your computer. Next time, it will be able to navigate directly to the correct IP address without needing to look it up in an online DNS server.

How to Clear the DNS Cache

Like other types of cache, a DNS cache can become outdated.

This happens when the IP address associated with a domain changes, such as when you move a WordPress site to a new domain name or move WordPress to a new host.

In those cases, your website will become associated with a new IP address, but the DNS cache may still contain the old address.

When this happens, you can follow our instructions on how to clear your DNS cache. We show you how to do this on Windows, Mac, and Chrome.

We hope this article helped you learn more about cache in WordPress. You may also want to see our Additional Reading list below for related articles on useful WordPress tips, tricks, and ideas.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Additional Reading

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!