Skip to main content

Speed Brain

Learning Focus

By the end of this lesson you will understand how Speed Brain works, how it predicts user navigation, and how to enable it for faster page transitions.

What Is Speed Brain?

Speed Brain is a Cloudflare feature that uses speculative prefetching to load pages before users click on them. By predicting which link a user is likely to click next, Speed Brain fetches and caches the page in the browser ahead of time, making page transitions feel near-instant.

flowchart LR
USER["User hovers\nover a link"] -->|Prefetch triggered| CF["Cloudflare Edge\n(fetches page)"]
CF -->|Pre-cached in browser| CACHE["Browser Cache"]
USER -->|User clicks link| CACHE
CACHE -->|"Instant load\n(already cached)"| PAGE["Page Rendered"]

style CF fill:#f6821f,color:#fff,stroke:#e5711e
style CACHE fill:#2563eb,color:#fff,stroke:#1e40af
style PAGE fill:#16a34a,color:#fff,stroke:#15803d

How It Differs from Regular Browsing

Without Speed BrainWith Speed Brain
User clicks a linkBrowser starts fetching the pagePage is already in cache
Perceived load time200–2000msNear-instant (~0ms)
Origin load impactOne request per page viewSlightly more prefetch requests, but served from CDN cache

How Speed Brain Works

Speed Brain uses the Speculation Rules API — a web standard that allows the page to declare which URLs should be prefetched or pre-rendered by the browser.

Cloudflare injects speculation rules into your HTML responses based on the links present on the page:

Injected by Cloudflare (you don't write this)
<script type="speculationrules">
{
"prefetch": [
{
"source": "document",
"where": { "href_matches": "/*" },
"eagerness": "moderate"
}
]
}
</script>

Eagerness Levels

LevelTriggerUse Case
ConservativeOnly when user clicks a linkMinimal bandwidth, slight improvement
ModerateWhen user hovers over a linkGood balance — prefetches on intent signal
EagerPrefetch all links on page loadMaximum speed, higher bandwidth usage

Enabling Speed Brain

  1. Go to Cloudflare Dashboard → Speed → Optimization → Speed Brain
  2. Toggle Enabled
  3. Choose eagerness level (recommend starting with Moderate)
info

Speed Brain is free and available on all Cloudflare plans. It requires no code changes to your site.

Browser Support

Speed Brain relies on the Speculation Rules API:

BrowserSupport
Chrome 121+✅ Full support
Edge 121+✅ Full support
Firefox⏳ Not yet (gracefully degrades)
Safari⏳ Not yet (gracefully degrades)

On browsers that don't support Speculation Rules, Speed Brain has no effect — your site works normally with no penalty.

Impact on Origin Load

Speed Brain is designed to be CDN-aware:

  • Prefetched pages are served from Cloudflare's cache, not your origin
  • Only cache misses reach your origin
  • If your pages are well-cached (using Cache Rules for HTML), Speed Brain adds negligible origin load
tip

Combine Speed Brain with Cache Rules that cache your HTML pages at the edge. This way, prefetch requests are served entirely from Cloudflare's cache, giving maximum speed with zero origin impact.

Common Misconceptions

"Speed Brain will increase my server load"

Reality: Prefetch requests hit Cloudflare's edge cache. If your pages are cached, your origin sees no additional traffic.

"Speed Brain works on all browsers"

Reality: It currently works on Chromium-based browsers (Chrome, Edge). Other browsers gracefully degrade with no side effects.

"Prefetching wastes bandwidth for mobile users"

Reality: With "moderate" eagerness, prefetching only triggers on hover intent, which is a strong signal that the user will navigate. Data waste is minimal.

Key Takeaways

  • Speed Brain makes page navigation feel instant by prefetching pages before users click.
  • It uses the Speculation Rules API — a web standard.
  • It's free on all Cloudflare plans and requires no code changes.
  • Prefetch requests are served from Cloudflare's edge cache — minimal origin impact.
  • Works on Chromium browsers (Chrome, Edge) and degrades gracefully on others.

What's Next

  • Continue to DDoS Protection to learn how Cloudflare protects against volumetric and application-layer attacks.