- Hreflang identifies language and region alternatives so Google can show the appropriate version; it is not a ranking boost.
- Choose HTML tags, HTTP Link headers or an XML sitemap. Google treats the three methods as equivalent.
- Each version should list itself and all its equivalents, with matching return links.
- Use en-GB, not en-UK, and ja, not jp. x-default supplies a fallback when no listed language or region matches.
- Check one page with the free hreflang checker before rolling the same template across your site.
What does hreflang do?
Hreflang tells Google which language or regional version of a page to show a searcher; it is not a ranking boost.
Use it for translations and regional equivalents, such as a general English product page, a British English version with local prices and a German translation. Connect pages about the same thing, rather than sending every translated article to a language homepage.
Google still determines a page's language from its content. Hreflang labels the relationship between versions; it does not translate the text or guarantee indexing. See Google's localized versions documentation.
Three ways to add hreflang
Add hreflang through HTML link tags, HTTP Link headers or an XML sitemap; choose the method you can maintain consistently.
The examples below use fictional URLs on example.com. Replace them with your final published addresses. Google considers these methods equivalent, so implementing all three brings no search benefit and creates more places for mistakes.
HTML link tags in the head
Place this complete set in the <head> of each equivalent HTML page, including the fallback page. The same English URL can be both the generic English version and the fallback.
<link rel="alternate" hreflang="en" href="https://example.com/guide" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/uk/guide" />
<link rel="alternate" hreflang="de" href="https://example.com/de/guide" />
<link rel="alternate" hreflang="x-default" href="https://example.com/guide" />
HTTP Link headers for PDFs
A PDF has no HTML head. Configure its server response to send a Link header with every equivalent PDF. The line breaks below are for readability; send the comma-separated values as one header.
Link: <https://example.com/guide.pdf>; rel="alternate"; hreflang="en",
<https://example.com/uk/guide.pdf>; rel="alternate"; hreflang="en-GB",
<https://example.com/de/guide.pdf>; rel="alternate"; hreflang="de",
<https://example.com/guide.pdf>; rel="alternate"; hreflang="x-default"
Send the identical alternate set with each PDF response. This is a response header, not a meta tag embedded in the document.
XML sitemap annotations
Declare the XHTML namespace and give every URL its own <url> entry containing the same alternate list, including itself. This short example shows one entry; add matching entries for the British English and German URLs before publishing the sitemap.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://example.com/guide</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/guide" />
<xhtml:link rel="alternate" hreflang="en-GB" href="https://example.com/uk/guide" />
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/guide" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/guide" />
</url>
</urlset>
Hreflang rules: self-reference, return tags and valid URLs
A reliable hreflang set lists every equivalent page, uses valid codes and points directly to indexable canonical URLs returning HTTP 200.
- Include the current page. The English version lists English, British English and German; the German version lists the same set. Keep the x-default entry consistent too.
- Match return links both ways. If English names German as
de, German must name English asen. Google ignores a pairing without reciprocal annotations. Compare the complete URLs, not just the language labels. - Use ISO 639-1 language codes. Add an optional ISO 3166-1 Alpha-2 region:
en,en-GBandde-DEare valid. A country code alone is not a language. - Use GB for the United Kingdom.
en-UKis wrong; useen-GB. Japanese isja, orja-JPfor Japan. - Use absolute URLs. Include the protocol and host, and match the final path and trailing slash exactly.
- Check canonical and indexability signals. Keep each language's canonical in that language. Do not nominate redirects, errors or noindexed pages as search alternatives.
For same-language regional duplicates, choose a preferred canonical in that language and align the annotations with it. Google's canonicalization guidance explains how canonical and hreflang signals should agree.
What is x-default hreflang?
The x-default hreflang value identifies the fallback page for people whose language or region does not match another listed version.
It can point to a language picker or a suitable default page. In the examples above, general English is also the fallback. If you have a dedicated selector, replace the x-default URL throughout the set with its actual address and include the annotations on that page too.
Do not use x-default as a language code for a translation. Keep de for German, en for general English and en-GB for British English. A general English alternative also covers English speakers outside the regions you explicitly target.
Common hreflang errors and fixes
The most common hreflang errors are missing return tags, invalid codes and targets that conflict with redirects or indexing signals.
Hreflang troubleshooting
| Error | What to check | Fix |
|---|---|---|
| Missing return tag | English points to German, but German does not point back. | Add the reciprocal English annotation on German and align the full set. |
| Wrong code: en-uk or jp | The region or language code is invalid. | Use en-GB for British English and ja for Japanese. Capitalization alone does not repair a wrong code. |
| Redirected target | The hreflang URL returns 301 or 302. | Replace it with the final canonical URL everywhere in the set. |
| Noindexed target | The alternate has a robots meta or HTTP noindex directive. | Use an indexable equivalent, or remove noindex if the page is intended for search. |
| Canonical points to another language | A German translation names English as canonical. | Keep the German canonical in German and make hreflang point to that preferred URL. |
| Missing self-reference | The current page lists translations but omits itself. | Add its own language code and canonical URL to the set. |
What about hreflang on Bing?
For Bing, set language metadata as well as hreflang: Content-Language and the HTML lang attribute provide language signals.
Bing's published language guidance prioritizes the content-language meta tag, lists HTML lang as an alternative and describes the Content-Language HTTP header. That guidance dates from 2011; it does not establish Bing's current signal weights.
<html lang="de">
<!-- If retaining legacy Bing metadata, keep it consistent: -->
<meta http-equiv="content-language" content="de">
Content-Language: de
The last line is an HTTP response header, not HTML. Prefer the header for audience metadata and always set HTML lang for the text language. The W3C explains that the content-language meta form is obsolete in HTML; it cannot replace lang for accessibility. Keep every declaration consistent with the page.
How to check your hreflang tags
Start with the free hreflang checker for one HTML page, then investigate redirects and check the wider site.
Check one representative page
Paste the URL into the checker. It reads hreflang tags in the HTML head, validates codes and checks up to 25 alternate URLs for status, return links and canonical conflicts. It does not validate a PDF's Link header or sitemap annotations; inspect those implementations separately.
Resolve redirected targets
Use the redirect checker to find the final address, update the whole alternate set and check again.
Check the whole site
Start with the free site audit tool to crawl beyond one page. Review the crawl's coverage and limits, then fix the template so the correction reaches every affected language version.
After publishing, check the live responses again. A correct set in a CMS field is only useful when the server actually delivers it on every equivalent page.
Questions and answers
Hreflang tags questions
What are hreflang tags?
Hreflang annotations connect equivalent pages for different languages or regions so Google can show an appropriate version in search.
Does hreflang improve rankings?
Hreflang is language and region targeting, not a ranking boost. It helps Google choose between equivalent versions rather than making a page more relevant to every query.
What is an x-default hreflang example?
A general English page can be listed as both en and x-default. Alternatively, x-default can point to a language picker for visitors whose language or region does not match a listed version.
What are hreflang return tags?
Return tags are reciprocal annotations: if page A lists page B as an alternate, page B lists page A back. Each version should also include itself.
Should I use en-UK or en-GB?
Use en-GB. The region must use an ISO 3166-1 Alpha-2 code, and GB is the correct value for the United Kingdom.
Can I add hreflang to a PDF?
Yes. Send an HTTP Link header listing all equivalent documents, including the current PDF. Repeat the same alternate set in each document's response.
Sources
- Tell Google about localized versions — Google Search Central: implementation methods, reciprocal annotations, supported codes and x-default
- Canonical URL guidance — Google Search Central: align hreflang and canonical signals within the same language
- HTTP headers, meta elements and language information — W3C: HTML lang, audience metadata and the obsolete content-language meta element

