# \[rel="dns-prefetch"\]

> The `dns-prefetch` value of the `rel` HTML attribute tells the browser to resolve the domain name of an origin in advance.

## What is dns-prefetch and when should I use it?

The value of the `rel` attribute of the `<link>` element that performs only the DNS lookup for another origin ahead of time. It is cheaper than `preconnect` and suits origins that may be used later on the page.

- Topic: Links
- Type: attribute
- Browser support: Chrome 46+, Chrome Android 46+, Edge 79+, Firefox 127+, Firefox Android 127+, Safari 5+, Safari iOS 26+

## Example

Wrong:

```html
<link rel="dns-prefetch" href="/api">
<link rel="dns-prefetch" href="/images">
```

Right:

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

Hints point to another origin, and pairing `dns-prefetch` with `preconnect` gives a cheap fallback.

## Common mistakes

- Adding `dns-prefetch` for the page's own domain, which is already resolved.

## Key points

- The `href` is an origin of another domain, not the site's own domain.
- It is used for third-party origins the page may contact later, not a long list of every domain.
- For the most important origins it is paired with `rel='preconnect'`.

## Interview questions

### Does dns-prefetch help for my own domain?

No, the current domain is already resolved when the page loads, so the hint has no effect.

### Is dns-prefetch still useful if I use preconnect?

Yes, as a fallback and for origins the page might use later, where opening a full connection would be wasteful.

## Related cards

- [\[rel="preconnect"\]](https://wonderium.dev/html/rel-preconnect.md)
- [\[rel="preload"\]](https://wonderium.dev/html/rel-preload.md)
- [DNS](https://wonderium.dev/web/dns.md)
- [prefetchDNS()](https://wonderium.dev/react/prefetch-dns.md)
- [`<link>`](https://wonderium.dev/html/link.md)

---

- Level: [HTML](https://wonderium.dev/html.md)
- HTML version: https://wonderium.dev/html/rel-dns-prefetch
- Last updated: 2026-11-25
