Speed Brain
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 Brain | With Speed Brain | |
|---|---|---|
| User clicks a link | Browser starts fetching the page | Page is already in cache |
| Perceived load time | 200–2000ms | Near-instant (~0ms) |
| Origin load impact | One request per page view | Slightly 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:
<script type="speculationrules">
{
"prefetch": [
{
"source": "document",
"where": { "href_matches": "/*" },
"eagerness": "moderate"
}
]
}
</script>
Eagerness Levels
| Level | Trigger | Use Case |
|---|---|---|
| Conservative | Only when user clicks a link | Minimal bandwidth, slight improvement |
| Moderate | When user hovers over a link | Good balance — prefetches on intent signal |
| Eager | Prefetch all links on page load | Maximum speed, higher bandwidth usage |
Enabling Speed Brain
- Go to Cloudflare Dashboard → Speed → Optimization → Speed Brain
- Toggle Enabled
- Choose eagerness level (recommend starting with Moderate)
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:
| Browser | Support |
|---|---|
| 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
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.