How Google Search uses speculation rules

Published: Feb 12, 2025

Google Search is one of the most popular sites on the web, and also one of the fastest. The Search team is continually investing in making the search experience faster. On a page as popular as Google Search, even milliseconds of improvement quickly add up! That interest in speed includes the well-known Google home page, the Search Engine Results Page (SERP), and clicks to other sites from those search results.

Google Search has been making use of the Speculation Rules API to improve navigation speed from the search results page to the result links and they've been using a few features of the API that may be of interest to other site owners.

Prefetch the first two results

One of the first uses of speculation rules was to prefetch the first two search results. Searching for "test" for example includes the following speculation rule in the page:

{
    "prefetch": [{
        "source": "list",
        "requires": [
            "anonymous-client-ip-when-cross-origin"
        ],
        "referrer_policy": "strict-origin",
        "urls": [
            "https://www.merriam-webster.com/dictionary/test",
            "https://dictionary.cambridge.org/dictionary/english/test"
        ]
    }]
}

The two URLs at the bottom are the first two search results, and they are immediately prefetched. If the user clicks on those, then they will have gotten a head start as the HTML document should already be available to the browser.

The rule and the prefetch attempts can be seen in DevTools Application -> Speculation tab as documented previously:

DevTools Speculation panel showing listing two dictionary definitions of the word text, both successfully prefetched
Speculations panel with two successful prefetches.

Privacy-preserving prefetches

Because these links are for content on another sites, there are some additional privacy considerations for prefetching since the user has not yet visited those sites.

Thankfully the API was designed with this in mind, and Google Search is making use of two features to preserve user privacy.

The first is the in using the requires configuration, to ensure prefetches use the private prefetch proxy in Chrome:

"requires": [
    "anonymous-client-ip-when-cross-origin"
],

This uses a proxy to make sure the connection anonymizes the IP address so we don't leak the user's IP to the site before the user clicks on the link to navigate to it from the search results page.

Secondly, Google Search uses the referrer_policy setting to ensure no details encoded in the search page's URL are sent to the site in the referer HTTP header:

"referrer_policy": "strict-origin",

Most browsers now default to strict-origin-when-cross-origin but this setting uses a stricter setting to use strict-origin referrer policy even for same-origin prefetches.

A third protection automatically happens if the user has cookies for the site. In this case, they may receive different results based on those cookies, and Chrome won't use the prefetched HTML:

DevTools Speculation panel two URLs, but one has failed to prefetch with an error saying it was not eligible as the user had cookies for that origin
Speculations panel with one failed prefetch due to cookies.

This does mean that users with cookies won't benefit from the improved performance prefetching provides when clicking on that site, but privacy protection and accurate page loads are prioritized. Additionally, if a user has already visited a site and has cookies for it, then they are more likely to have some assets from that site cached and will likely experience a faster page load even without prefetching.

Impact to users of prefetching the first two results

As with most changes, Google Search rolled prefetching out in an A/B test experiment, and measured the impact. They saw significant improvements in Largest Contentful Paint (LCP). On Chrome for Android, LCP for clicks from Google Search were reduced by 67 milliseconds. A followup launch for desktop Chrome resulted in a similar improvement in LCP of 58.6 milliseconds. These are improvements to the site being navigated to, not to the Google Search site itself—but it benefits Google Search users.

These improvements in LCP may seem insignificant, but for a hyper-optimized site like Google Search, we celebrate even millisecond improvements for our users, so improvements in the range of tens of milliseconds are unusual! Your site may see a significantly larger benefit—you should try it to find out!

Prefetching using Speculation Rules has been enabled by default on Search on Android since October 2022 and was rolled out to desktop by September 2024.

Beyond the first two results

Since the Speculation Rules API's initial launch, it was enhanced with an eagerness property that allows speculations to only happen when the user hovers on, or starts to click a link.

Google Search decided to move beyond the first two search results and also prefetch remaining search results—but only when the user hovers over the link, by using the moderate eagerness setting. This prevents the unnecessary waste of resources for links that are less likely to be clicked.

Again, the rule can be seen in DevTools when you search in Chrome, and it's identical to the previous rule, but this time with the "eagerness": "moderate" option set:

DevTools Rules panel showing a list rule using anonymouse-client-ip-when-cross-origin, a strict-origin referrer policy, moderate eagerness and seven URLs
The speculation rule used by Google Search.

Hovering over these links will trigger the prefetch. Note that Google Search explicitly lists the URLs rather than using the document rules feature of the Speculation Rules API, since they don't want to prefetch other URLs like ads.

Impact to users of prefetching the beyond the first two results

Desktop Chrome reduced First Contentful Paint (FCP) for navigations from Google Search by 7.6 milliseconds and LCP by 9.5 milliseconds (as shown by A/B testing). These represent smaller gains compared to the 58.6 milliseconds improvements seen in the first two results, but that's not surprising given the smaller lead time as they are not prefetched as eagerly. However, these are still good gains for the same reasons given earlier.

Prefetching of the remaining search results on desktop was rolled out by default in December 2024.

For mobile—where hover is usually not available—there was no real improvement seen and so, while there were also no regressions, these additional prefetches were not enabled on mobile.

Google is not finished experimenting with this exciting new API, and our hope is to make browsing the web as fast as possible. We have a few other tricks up our sleeve that we're working on.

As just one example, Chrome is rolling out prerendered search results pages—for users with preload enabled—when users type search queries in the Chrome address bar, and in other places like the search box on Android. This is also open to other search engines to implement too—not just Google Search—though we're unaware of any implementations for other search engines at this time.

Google Search is not looking to go further and implement prerender for the result links themselves, since this is not available for cross-sites navigation (and must even be opted in for same-site, cross-origin prerenders).

A note on browser support

Browser Support

  • Chrome: 109.
  • Edge: 109.
  • Firefox: not supported.
  • Safari: not supported.

The Speculation Rules API is implemented in Chromium-based browsers at this time, but Chrome is publishing the API specification through the W3C standards process and are keen for other browsers to implement this API.

The private prefetch proxy is currently only implemented in Chrome and not other Chromium-based browsers, but if other browsers implement their own private prefetch proxy, Google Search may look to implement these improvements there too.

Due to the privacy implications of prefetching without a private prefetch proxy, Google Search doesn't prefetch on browsers which don't support this technology, and so have not implemented a fallback using other technologies for other browsers. However, as a progressive enhancement, this just means users on those browsers don't benefit from this small speed increase.

Try it on your site!

The Speculation Rules API is available for all sites to use, not just Google Search. Beyond the prefetching capabilities discussed here, prerendering offers further benefits when and where it can be used. With large sites like Google Search showing clear benefits of this API for the user experience, we encourage all site owners to look into how they can use and potentially benefit from the API.

Additionally, the privacy protections detailed in this post are also available to other sites—with the caveat that users must have Extended Preload support enabled in their settings to allow non-Google sites to route traffic using Google's private prefetch proxy. This is because this introduces Google as an extra party between the user and the site whereas this is not necessary on Google sites—since they are already one of the involved parties.