{"id":15008,"date":"2026-11-09T09:32:38","date_gmt":"2026-11-09T08:32:38","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=15008"},"modified":"2026-11-09T09:32:43","modified_gmt":"2026-11-09T08:32:43","slug":"browser-caching-explained-cache-control-etags-and-expires-compared","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/en\/knowledgebase\/browser-caching-explained-cache-control-etags-and-expires-compared\/","title":{"rendered":"Browser Caching Explained: Cache-Control, ETags, and Expires Compared"},"content":{"rendered":"\n<div class=\"translation-block translation-block-merged\"><p class=\"wp-block-paragraph\">Browser caching stores copies of web files so they can be reused without downloading them on every request. This can make a site faster, but it can also make a browser show an older CSS file, JavaScript file, image, or HTML document after an update.<\/p><p class=\"wp-block-paragraph\">The main response headers that control this behaviour are <code>Cache-Control<\/code>, <code>ETag<\/code>, and <code>Expires<\/code>. They control different parts of caching: how long a response may be reused, how a browser checks whether it changed, and when a cached response becomes stale.<\/p><div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/browser-caching-explained-cache-control-etags-and-expires-compared\/#How_browser_caching_works\" >How browser caching works<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/browser-caching-explained-cache-control-etags-and-expires-compared\/#Cache-Control_the_main_caching_policy\" >Cache-Control: the main caching policy<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/browser-caching-explained-cache-control-etags-and-expires-compared\/#Example_a_long-lived_versioned_asset\" >Example: a long-lived versioned asset<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/browser-caching-explained-cache-control-etags-and-expires-compared\/#Example_an_HTML_document_that_should_be_checked\" >Example: an HTML document that should be checked<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/browser-caching-explained-cache-control-etags-and-expires-compared\/#ETag_checking_whether_a_file_changed\" >ETag: checking whether a file changed<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/browser-caching-explained-cache-control-etags-and-expires-compared\/#Expires_an_older_freshness_rule\" >Expires: an older freshness rule<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/browser-caching-explained-cache-control-etags-and-expires-compared\/#Cache-Control_ETag_and_Expires_compared\" >Cache-Control, ETag, and Expires compared<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/browser-caching-explained-cache-control-etags-and-expires-compared\/#Choosing_a_policy_for_different_content\" >Choosing a policy for different content<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/browser-caching-explained-cache-control-etags-and-expires-compared\/#Static_assets\" >Static assets<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/browser-caching-explained-cache-control-etags-and-expires-compared\/#HTML_documents\" >HTML documents<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/browser-caching-explained-cache-control-etags-and-expires-compared\/#Frequently_changing_content\" >Frequently changing content<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/browser-caching-explained-cache-control-etags-and-expires-compared\/#Preventing_stale_update_problems\" >Preventing stale update problems<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_browser_caching_works\"><\/span>How browser caching works<span class=\"ez-toc-section-end\"><\/span><\/h2><\/div>\n\n<div id=\"mybox-58742629\" class=\"mybox-content mybox-entity-placement\"><div class=\"early-access-banner-inpost\">\r\n  <div class=\"banner-left-inpost\">\r\n    <div class=\"icon-box-inpost\">\r\n      <img decoding=\"async\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/02\/square-info-icon.svg\" alt=\"Info\">\r\n    <\/div>\r\n    <div class=\"text-box-inpost\">\r\n      <span class=\"label-inpost\"><span class=\"translation-block translation-block-banner-text\">Early access<\/span><\/span>\r\n      <h4><span class=\"translation-block translation-block-banner-text\">Still need help?<\/span><\/h4>\r\n      <p><span class=\"translation-block translation-block-banner-text\">Contact our customer service team.<\/span><\/p>\r\n    <\/div>\r\n  <\/div>\r\n\r\n  <div class=\"banner-right-inpost\">\r\n    <a href=\"https:\/\/panel.mybox.com\/helpdesk2\/v\/list\/\" class=\"banner-button-inpost\"><span class=\"translation-block translation-block-banner-text\">Message us<\/span><\/a>\r\n  <\/div>\r\n<\/div><\/div>\n\n<div class=\"translation-block translation-block-merged\"><p class=\"wp-block-paragraph\">When a browser requests a file, the server can return the file together with caching headers. The browser stores the response and follows those headers on later visits.<\/p><p class=\"wp-block-paragraph\">While the cached response is fresh, the browser can use it without contacting the server. This is the main reason an updated file may not appear immediately. The browser is following the previous caching instructions, not necessarily ignoring the update.<\/p><p class=\"wp-block-paragraph\">When the response becomes stale, the browser can contact the server to revalidate it. Revalidation checks whether the cached copy is still current. If it is unchanged, the server can confirm that the browser may keep using its copy. If it changed, the server sends the new response.<\/p><h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Cache-Control_the_main_caching_policy\"><\/span>Cache-Control: the main caching policy<span class=\"ez-toc-section-end\"><\/span><\/h2><p class=\"wp-block-paragraph\"><code>Cache-Control<\/code> is the most flexible header in this comparison. It can set a freshness period and define whether a response may be stored or must be checked again.<\/p><ul class=\"wp-block-list\">\n<li><code>max-age=3600<\/code> allows a cached response to be reused for 3,600 seconds, or one hour, before it becomes stale.<\/li>\n<li><code>no-cache<\/code> allows storage but requires a check with the server before reuse.<\/li>\n<li><code>no-store<\/code> tells the browser not to store the response.<\/li>\n<li><code>must-revalidate<\/code> requires a stale response to be checked before it is reused.<\/li>\n<\/ul><p class=\"wp-block-paragraph\">These directives have different effects. <code>no-cache<\/code> does not mean &ldquo;do not save.&rdquo; It means &ldquo;do not use the saved response without revalidation.&rdquo; <code>no-store<\/code> is the directive for content that should not be stored.<\/p><h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Example_a_long-lived_versioned_asset\"><\/span>Example: a long-lived versioned asset<span class=\"ez-toc-section-end\"><\/span><\/h3><pre class=\"wp-block-code\"><code>Cache-Control: public, max-age=31536000, immutable<\/code><\/pre><p class=\"wp-block-paragraph\">This type of policy is suitable for a static asset when its URL changes whenever its contents change. For example, a site can load <code>app.abc123.js<\/code> and later publish <code>app.def456.js<\/code>. The old URL can remain cached because the new version uses a different URL.<\/p><h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Example_an_HTML_document_that_should_be_checked\"><\/span>Example: an HTML document that should be checked<span class=\"ez-toc-section-end\"><\/span><\/h3><pre class=\"wp-block-code\"><code>Cache-Control: no-cache<\/code><\/pre><p class=\"wp-block-paragraph\">This allows the browser to keep a copy while requiring revalidation before it uses that copy. It is useful when the HTML may change and the document contains links to current CSS or JavaScript files.<\/p><h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"ETag_checking_whether_a_file_changed\"><\/span>ETag: checking whether a file changed<span class=\"ez-toc-section-end\"><\/span><\/h2><p class=\"wp-block-paragraph\">An <code>ETag<\/code> is an identifier for a particular version of a response. The browser saves the value with the cached response. During revalidation, it sends that value back to the server in an <code>If-None-Match<\/code> request header.<\/p><p class=\"wp-block-paragraph\">If the server determines that the cached version is still current, it can return <code>304 Not Modified<\/code> without sending the full file again. The browser then uses its stored copy. If the identifier no longer matches, the server returns the updated response.<\/p><pre class=\"wp-block-code\"><code>ETag: \"asset-v2\"<\/code><\/pre><p class=\"wp-block-paragraph\">ETag validation reduces the amount of data transferred, but it does not decide when the browser must revalidate. A freshness rule such as <code>max-age<\/code> or <code>no-cache<\/code> controls that timing.<\/p><h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Expires_an_older_freshness_rule\"><\/span>Expires: an older freshness rule<span class=\"ez-toc-section-end\"><\/span><\/h2><p class=\"wp-block-paragraph\"><code>Expires<\/code> sets a fixed date and time after which a cached response is considered stale.<\/p><pre class=\"wp-block-code\"><code>Expires: Wed, 30 Dec 2026 12:00:00 GMT<\/code><\/pre><p class=\"wp-block-paragraph\">Unlike <code>Cache-Control: max-age<\/code>, which uses a relative number of seconds, <code>Expires<\/code> uses an absolute date. Clock differences can make absolute dates less reliable, so modern configurations normally use <code>Cache-Control<\/code> as the primary policy.<\/p><p class=\"wp-block-paragraph\">When both headers are present, a browser generally uses the more specific <code>Cache-Control<\/code> freshness rule instead of the older <code>Expires<\/code> rule. Keeping both may support older clients, but their values should not conflict.<\/p><h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Cache-Control_ETag_and_Expires_compared\"><\/span>Cache-Control, ETag, and Expires compared<span class=\"ez-toc-section-end\"><\/span><\/h2><figure class=\"wp-block-table\"><table>\n<thead><tr><th>Mechanism<\/th><th>What it controls<\/th><th>Typical use<\/th><\/tr><\/thead>\n<tbody>\n<tr><td>Cache-Control<\/td><td>Freshness, storage, and revalidation rules<\/td><td>Primary policy for most responses<\/td><\/tr>\n<tr><td>ETag<\/td><td>Whether a stored response matches the current server version<\/td><td>Efficient revalidation<\/td><\/tr>\n<tr><td>Expires<\/td><td>The date and time when a response becomes stale<\/td><td>Legacy or compatibility support<\/td><\/tr>\n<\/tbody>\n<\/table><\/figure><p class=\"wp-block-paragraph\">These mechanisms are not alternatives that must be used alone. A response can use <code>Cache-Control<\/code> to set its freshness policy and an <code>ETag<\/code> to support efficient revalidation. <code>Expires<\/code> can be added when compatibility with older behaviour is needed.<\/p><h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Choosing_a_policy_for_different_content\"><\/span>Choosing a policy for different content<span class=\"ez-toc-section-end\"><\/span><\/h2><h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Static_assets\"><\/span>Static assets<span class=\"ez-toc-section-end\"><\/span><\/h3><p class=\"wp-block-paragraph\">CSS, JavaScript, images, and font files can use a long freshness period when their URLs are versioned. Change the filename or query string when the content changes, then reference the new URL in the HTML.<\/p><pre class=\"wp-block-code\"><code>styles.v3.css\nstyles.v4.css<\/code><\/pre><p class=\"wp-block-paragraph\">This approach is called cache busting. It prevents a browser from treating a changed file as the same resource at the old URL.<\/p><h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"HTML_documents\"><\/span>HTML documents<span class=\"ez-toc-section-end\"><\/span><\/h3><p class=\"wp-block-paragraph\">HTML often controls which assets a visitor loads, so it usually needs a shorter freshness period or revalidation. A <code>no-cache<\/code> policy can keep the response stored while checking for updates before reuse.<\/p><h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Frequently_changing_content\"><\/span>Frequently changing content<span class=\"ez-toc-section-end\"><\/span><\/h3><p class=\"wp-block-paragraph\">For content that changes often, use a policy that requires regular revalidation. Use <code>no-store<\/code> when the response must not be stored at all. Use <code>ETag<\/code> when storing a response is allowed and returning a compact &ldquo;not changed&rdquo; response is useful.<\/p><h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Preventing_stale_update_problems\"><\/span>Preventing stale update problems<span class=\"ez-toc-section-end\"><\/span><\/h2><ol class=\"wp-block-list\">\n<li>Use long cache times only for files whose URLs change when their contents change.<\/li>\n<li>Use <code>no-cache<\/code> or a short <code>max-age<\/code> for HTML that must reflect recent changes.<\/li>\n<li>Keep the ETag current when the response content changes.<\/li>\n<li>Do not reuse an old asset URL for new file contents when that URL has a long cache lifetime.<\/li>\n<li>When using both <code>Cache-Control<\/code> and <code>Expires<\/code>, set values that describe the same freshness period.<\/li>\n<\/ol><p class=\"wp-block-paragraph\">A browser may continue to show an older file until its freshness period ends, until it revalidates the response, or until the page references a new cache-busted URL. That behaviour is normal when the previous response allowed the browser to reuse its stored copy.<\/p><\/div>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"template":"","format":"standard","manualknowledgebasecat":[11366,11490],"manual_kb_tag":[12102,12103,12104,12105,9488,12099,12100,12101],"class_list":["post-15008","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-hosting-internet-basics","manualknowledgebasecat-developer-resources","manual_kb_tag-cache-busting","manual_kb_tag-http-headers","manual_kb_tag-static-assets","manual_kb_tag-html-caching","manual_kb_tag-browser-caching","manual_kb_tag-cache-control-2","manual_kb_tag-etag","manual_kb_tag-expires"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/15008","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":1,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/15008\/revisions"}],"predecessor-version":[{"id":15012,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/15008\/revisions\/15012"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/media?parent=15008"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manualknowledgebasecat?post=15008"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb_tag?post=15008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}