If you run the same content in more than one language or for more than one country, knowing how to implement hreflang tags is what stops the wrong version showing to the wrong searcher. A German reader landing on the English page, or a UK shopper seeing US prices, is the problem hreflang exists to solve.
The markup itself is one line per version. The difficulty is that every version has to agree with every other version, and on a site with several languages that becomes a lot of lines that must all stay in step.
What hreflang does, and what it doesn’t
Ahrefs’ guide to hreflang tags defines hreflang as “an HTML attribute used to specify the language and geographical targeting of a webpage.” It tells search engines that a set of pages are alternates of one another, and which audience each one is for.
It is not a ranking boost, and it is not a substitute for a canonical tag. Each language version should be its own canonical page. Pointing a French page’s canonical at the English one tells search engines to ignore the French page, which contradicts the hreflang telling them to show it.

The basic syntax is a link element in the page head:
The codes: language first, region optional
The value has two parts. The language is required and uses an ISO 639-1 two-letter code, such as de for German. The region is optional and uses an ISO 3166-1 Alpha-2 country code, such as gb in en-gb. Language always comes first.
That ordering catches people out. A region on its own is not valid, so a tag for “the UK” without a language means nothing. And the UK’s country code is gb, not uk, a mistake common enough to check for on every audit.

Only add a region when the content genuinely differs by country: prices, currency, delivery, legal terms. If your Spanish page serves Spain and Mexico identically, a single es tag is cleaner than two regional ones pointing at the same URL.
How to implement hreflang tags: three methods
There are three places hreflang can live. They do the same job, so choose one per set of pages rather than mixing them.
| Method | Where it goes | Best for | Main drawback |
|---|---|---|---|
| HTML tags | Link elements in each page’s <head> | Most sites with a manageable number of versions | Adds lines to every page; edits touch templates |
| HTTP headers | A Link header in the server response | Non-HTML files such as PDFs | Hard to see and audit without tooling |
| XML sitemap | xhtml:link entries under each URL | Large sites with many language versions | Errors are invisible on the page itself |
For most sites, HTML tags are the easiest to understand and debug, because you can view source and see them. The sitemap method keeps page weight down and centralises the work in one file, which suits large catalogues; our guide to XML sitemaps covers the file format. Headers are the only option for files that have no head to put a tag in.

On WordPress, the usual route to add hreflang tags is a multilingual plugin that links translations together and outputs the tags for you. That saves the typing but not the checking: the plugin only knows about translations you have connected, so an unlinked page gets no tags at all.
Return tags, self-reference and x-default
This is where most implementations break. Ahrefs puts the rule plainly: “If page A links to page B in hreflang annotations, page B must link to page A in return.” A tag that is not confirmed by the other side is treated as unreliable.
Each version should also list itself, alongside every other version. So the German page carries the same full set of tags as the English and UK pages, including a line pointing at its own URL. In practice that means the hreflang block is identical on every page in the set, which makes it easy to generate from one source and easy to spot when one page differs.

x-default is the fallback for anyone whose language matches none of your versions. It usually points at a language selector or your main international page. It is optional, but leaving it out means searchers outside your listed markets get whatever the search engine picks.
The scale of the problem is worth knowing. Ahrefs studied 374,756 domains and found that “67% of the hreflang implementations had issues.” That figure describes the sites in Ahrefs’ sample, not the web as a whole, but it is a strong hint that a setup nobody has audited is more likely broken than not.
How to check hreflang tags
Checking is mostly about confirming that every set is complete and consistent. Work through these in order:
- Codes. Every value is a valid language code, optionally followed by a valid region code. No
uk, no region on its own. - Return tags. Every page listed in a set lists all the others back.
- Self-reference. Every page includes itself.
- Status codes. Every hreflang URL returns 200, not a redirect or a 404.
- Canonicals. Every hreflang URL is its own canonical, not pointing at another language.

A site crawler with an hreflang report handles the first four at scale. For a single page, view source and compare its block with the same block on each alternate. Search Console’s international reports can show what Google has picked up, though they lag behind changes.
Your site structure affects how much work this is. Separate country domains, subdomains and subfolders all work with hreflang, but each one changes how you manage tags, and our comparison of subdomains and subfolders covers the trade-offs.

One limitation applies whichever method you choose. Hreflang is a signal, not an instruction, and search engines can still show a different version if they judge it a better match. A correct setup makes the right result far more likely; it cannot guarantee it, and it cannot fix translations that are thin or machine-made.
The maintenance habit that matters most is generating tags from one list of equivalent URLs rather than editing pages by hand. When a page is added, removed or moved, the list changes once and every version updates together. Hand-edited sets drift, and drifted sets are where missing return tags come from.
Frequently asked questions
How do you implement hreflang tags?
Choose one method (HTML head tags, HTTP headers or an XML sitemap), list every language version on every page including itself, add x-default, and make sure each version links back to the others.
What format do hreflang codes use?
An ISO 639-1 language code, optionally followed by an ISO 3166-1 Alpha-2 region code, such as de or en-gb. The language always comes first.
What is x-default in hreflang?
It is the fallback version for searchers whose language matches none of your listed versions, often a language selector or main international page.
How do I add hreflang tags in WordPress?
Most sites use a multilingual plugin that connects translations and outputs the tags. Check that every translation is linked, because unlinked pages get no tags.
The takeaway Pick one method, use valid codes, make every version list itself and every other version, add x-default, and generate the tags from a single list so they never drift apart.

