TapCub is live — analytics, insights and live chat, free on one platform
Glossary

What is cache hit rate? Formula, CDN example and effect on page speed

Cache hit rate is the share of requests a cache answers without going to the origin. The formula with a CDN example, request versus byte ratio, why rates run low and how hit rate moves time to first byte.

Xu An Reviewed by Lucas Hayes Also called cache hit ratio Last updated Nov 22, 2026 Glossary

Quick answer

Cache hit rate is the share of requests a cache answers itself instead of passing to the origin server: hits ÷ (hits + misses). At 9,000 hits and 1,000 misses it is 90%. A higher rate means faster responses for visitors and less load on the origin.

Formula: Cache hit rate = cache hits ÷ (cache hits + cache misses) × 100

What cache hit rate measures

Cache hit rate is the share of requests that a cache answers itself instead of passing on to the origin server that holds the original content. A hit is served from the cache, which is fast and costs the origin nothing. A miss means the cache had nothing usable and had to fetch the content from the origin first, which is slower and loads the server.

On a website, the cache in question is usually a content delivery network, or CDN, that stores copies of your files in locations near visitors. The rate is reported per site, per file type or per path. It is also called cache hit ratio; the two names mean the same thing, though one can be written as a fraction and the other as a percentage.

This entry explains the formula, shows a worked example with a CDN, covers why rates are often lower than expected and links the rate to page speed. For the wider topic of how caching works on a site, see CDN cache.

The formula and a worked example

The formula divides hits by all cache lookups, which are hits plus misses.

Sample data: a CDN receives 10,000 requests in an hour. 9,000 are answered from the cache and 1,000 go to the origin.

  • Cache hit rate = 9,000 ÷ (9,000 + 1,000) = 9,000 ÷ 10,000 = 90.0%.
  • Cache miss rate = 100% − 90.0% = 10.0%.
  • Origin load = 1,000 requests, a tenth of what it would be with no cache.

The origin load line is the useful one. Moving from 90% to 95% looks like a small gain, but it halves the traffic that reaches the origin, from 1,000 to 500 requests. The last points of hit rate are worth the most to the servers.

Requests and bytes can disagree

The rate can be counted by request or by bytes, and the two can differ a lot. A request hit ratio treats a 30 KB page and a 200 KB image as equal. A byte hit ratio weights by size, and it relates to bandwidth cost.

Sample data: 10,000 requests in one hour, split by file type.

File typeRequestsAverage sizeHitsRequest hit rate
Images6,000200 KB5,40090.0%
Scripts and styles3,00060 KB2,90096.7%
HTML pages1,00030 KB00%
Total10,0008,30083.0%

The calculations: request hit rate = 8,300 ÷ 10,000 = 83.0%. Total bytes = 6,000 × 200 + 3,000 × 60 + 1,000 × 30 = 1,410,000 KB. Bytes served from cache = 5,400 × 200 + 2,900 × 60 = 1,254,000 KB. Byte hit ratio = 1,254,000 ÷ 1,410,000 = 88.9%.

The two figures, 83.0% and 88.9%, answer different questions: the first says how often visitors skip the origin, the second says how much of the transfer the origin avoids. Report both, and report them by file type, because an overall figure hides that HTML pages in this sample are never cached.

Why a hit rate is lower than expected

Most low rates trace back to a short list of causes. The examples are from the documentation of two CDNs, cited in Sources.

  • Dynamic content is not cached by default. One CDN's documentation says it does not cache HTML or JSON by default and caches by file extension, not by content type.
  • Headers can switch caching off. The same documentation lists Cache-Control values of private, no-store, no-cache or max-age=0, a Set-Cookie header and non-GET requests as reasons content is not cached.
  • A short lifetime. The other CDN's documentation says the shorter the cache duration, the more often it sends requests to the origin to check for a newer version, so it advises the longest practical max-age.
  • Too many cache keys. The cache stores a separate copy for each distinct key. That documentation explains that parameter1=A and parameter1=a are stored separately even when the content is identical, and the same goes for parameters in a different order.
  • Forwarding every cookie or header. If two cookies each have three possible values, every combination can produce a separate request to the origin, up to 3 × 3 = 9 variants per object.

A quick diagnosis: take your ten most requested URLs, look at the status the CDN reports for each, and see which of the five causes applies. Fixing the top ten usually moves the total more than tuning a hundred small files.

How hit rate changes page speed

A hit is served from a location near the visitor and skips the trip to the origin, so it mainly improves time to first byte, the time until the first byte of the response arrives. web.dev gives a rough guide for that metric, measured at the 75th percentile of page loads: 0.8 seconds or less is good, between 0.8 and 1.8 seconds needs improvement and above 1.8 seconds is poor.

The 75th percentile matters because it ignores the fastest three quarters of loads. That produces a sharp effect, which this sample shows. Assume a hit returns in 80 milliseconds and a miss in 900 milliseconds.

Hit rateAverage time to first byte75th percentile
95%121 ms80 ms
90%162 ms80 ms
80%244 ms80 ms
70%326 ms900 ms
50%490 ms900 ms

The average changes smoothly: 0.9 × 80 + 0.1 × 900 = 162 ms. The 75th percentile does not. While the hit rate is at least 75%, the 75th percentile falls in the hit group, so it is 80 ms. Below 75%, it falls in the miss group, so it is 900 ms, over the 0.8 second line. A drop from 80% to 70% looks minor in the average, 244 ms to 326 ms, yet it moves the metric that counts from good to needs improvement.

The rule that follows: keep the hit rate for HTML and API responses above 75%, or watch the 75th percentile as well as the average. Static files can usually go much higher.

How to raise a hit rate

Work through these in order, because each is cheaper than the next:

  1. Lengthen the lifetime of files that rarely change. Set a long max-age on images, scripts and styles, and use file names that change when content changes so a long lifetime is safe.
  2. Normalize query strings. Use one case and one order for parameters, and ignore parameters that do not change the content, such as tracking tags.
  3. Trim the cache key. Forward only the cookies and headers the origin actually uses to vary a response, and keep dynamic and static content on separate rules.
  4. Cache HTML only where it is safe. Pages that do not vary by person, such as an article, can be cached for a short time. Pages that depend on a login should not be.
  5. Add a tier. A shield layer in front of the origin collects misses from many locations into fewer origin requests.

Measure after each step, and change one thing at a time so you know which fix moved the number.

What a good hit rate looks like

There is no single target. Static files are expected to have a high rate, while a site that serves mostly personalized HTML will have a low one by design, and that is not a fault. Compare the same file type over time, and treat a drop of more than a few points in a day as a signal to check for a deploy, a new tracking parameter or a header change.

Checking the effect in TapCub

TapCub does not report cache hits; that status lives in your CDN or server logs. What TapCub can show is the result visitors feel, which is the check that a hit-rate change helped.

  1. Open the real-user timing. In Monitoring › Performance, the Time to first byte card uses thresholds of 800 milliseconds for good and 1.8 seconds for poor, matching the guide above.
  2. Use the right percentile. Cards can switch among P95, P75, the median and the average. Use P75 to match the thresholds, and compare it with the median to see how far the slow loads are from the typical one.
  3. Find the pages. Break the figures down by page, country, device, browser and operating system. A page whose time to first byte is high only in one country can point to a cache location problem.
  4. Separate backend from the rest. Load timing splits one load into backend (time to first byte), network transfer and frontend render, so you can tell a server problem from a heavy-page problem.
  5. Compare before and after. Note the date of the cache change on Configuration › Annotations, then look at P75 on the same pages afterwards. The page has no previous-period comparison, so the annotation and a screenshot of the earlier figure are the baseline.

If the script is blocked, the page is empty and no server time is substituted. The data comes from visitors' browsers, so it shows what real people experienced.

Sources

Was this explanation clear?

We use your answers to fix and expand this page.

Xu An

Customer Experience Consultant

Writes about live chat, visitor conversations, and self-service, sharing practical ways to make customer communication clearer and more effective.

FAQ

Questions people ask

Short answers to the follow-up questions that come up most.

Still have a question?

Chat with the team behind TapCub — we usually reply within a few hours on business days.

How do you calculate cache hit rate?

Divide the number of requests served from the cache by the total number of cache lookups, which is hits plus misses, then multiply by 100. For example, 9,000 hits and 1,000 misses give 9,000 ÷ 10,000 = 90%. Count by request or by bytes, and say which.

What is a good cache hit rate?

There is no single target. Static files such as images, scripts and styles should reach a high rate, while a site that serves mostly personalized HTML will have a lower rate by design. Track the same file type over time and investigate drops of several points.

What is the difference between cache hit rate and cache miss rate?

They add up to 100%. The hit rate is the share answered from the cache, and the miss rate is the share that went to the origin. A 90% hit rate is a 10% miss rate, and each miss means a slower response and a request to the origin server.

How does cache hit rate affect page speed?

A hit skips the trip to the origin, which mainly lowers time to first byte. Because the guide thresholds use the 75th percentile, the metric can jump when the hit rate falls below about 75%: in a sample with 80 ms hits and 900 ms misses it goes from 80 ms to 900 ms.

See this number on your own site

Add one script tag for web and apps, and the first reports fill in within minutes.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics