DNS prefetch is a browser optimization technique that proactively resolves the DNS (domain name to IP address conversion) for linked domains before the user clicks. When the link is actually clicked, DNS resolution is already complete, so loading starts sooner by however long that lookup would have taken. How much time this saves depends on the connection and on whether the answer is already cached.
How long DNS resolution takes depends on the connection and on whether the answer is already cached, and it tends to be longer on mobile connections. DNS prefetch gets that wait out of the way before the click. It is enabled simply by adding <link rel="dns-prefetch" href="https://example.com/"> in the HTML head, with the scheme included in the href.
For shortened URLs, DNS prefetch can improve redirect speed. Clicking a shortened URL triggers DNS resolution for the shortener's domain first, then for the destination domain. Prefetching the destination domain eliminates the second DNS lookup, improving perceived speed.
Related technologies include preconnect (DNS resolution + TCP connection + TLS handshake in advance), prefetch (downloading the entire resource ahead of time), and prerender (rendering the full page in advance, now deprecated, with page-level speculative loading handled by the Speculation Rules API). In terms of resource cost versus benefit, dns-prefetch is the lightest with the fewest side effects, making it ideal for pages with many external links.
One caveat: DNS prefetch increases requests to DNS servers. Setting prefetch for every external link on a page adds unnecessary DNS server load, so it is best to limit it to the most important link destinations. Note also that dns-prefetch only helps for cross-origin domains: your own domain has already been resolved by the time the browser reads the hint. When you use preconnect, pairing it with dns-prefetch for the same domain is still worthwhile, because browsers without preconnect support can at least get the DNS lookup done early.