---
title: "dns-prefetch · Link relation · zhead"
canonical_url: "https://zhead.dev/link/dns-prefetch"
last_updated: "2026-08-13T08:00:02.815Z"
meta:
  description: "Asks the browser to resolve an origin's hostname before a resource from that origin is requested."
  "og:description": "Asks the browser to resolve an origin's hostname before a resource from that origin is requested."
  "og:title": "dns-prefetch · Link relation · zhead"
---

Link

# dns-prefetch

Asks the browser to resolve an origin's hostname before a resource from that origin is requested.

## Code examples

Good example

```
<link rel="dns-prefetch" href="//cdn.example.com">
```

Starts DNS resolution for a CDN origin the page expects to use.

Avoid this example

```
<link rel="dns-prefetch" href="#">
```

Points back to the current document and provides no useful external DNS hint.

## Recommendations

- 01 Reserve it for likely origins Each hint can trigger network work. Add it only for external origins the page is likely to use soon.
- 02 Use preconnect when connection setup matters Preconnect can also cover TCP and TLS setup. Use dns-prefetch when DNS resolution alone is enough or as a lightweight fallback.
- 03 Account for privacy A DNS lookup can reveal interest in a hostname before the user requests a resource from it.

## Related documentation

- [HTML Living Standard: Links](https://html.spec.whatwg.org/multipage/links.html#link-type-dns-prefetch)