If your site serves more than one language or country, hreflang tags are how you tell Google which version of a page to show to which audience. Get them right and a French user sees your French page while a UK user sees your UK page. Get them wrong and you get the classic international-SEO headaches: the wrong language ranking, duplicate-content confusion, and pages competing with themselves. This guide covers the syntax, x-default, and the mistakes that break hreflang most often.
What hreflang does
Hreflang is an attribute that maps out the alternate language and regional versions of a page. It does two jobs. First, it tells search engines to show the right version to the right user based on their language and location. Second, it signals that these pages are intentional alternates of the same content, not duplicate content competing against each other. That second job is often the bigger win: without hreflang, near-identical pages in similar languages can cannibalise one another.
The correct syntax
Each page should list itself and every alternate, using a language code, optionally followed by a region code. The value is an ISO 639-1 language (like en) and an optional ISO 3166-1 country (like en-GB or en-US). A typical set in the page <head> looks like this in principle: one line per language pointing at the matching URL, plus the page’s own self-reference. The three rules that matter most:
- Language first, region optional. Use
frfor all French speakers, orfr-CAto target French Canada specifically. - Every page references itself. A page must include an hreflang entry pointing at its own URL.
- Use absolute URLs. Always the full
https://address, never relative paths.
Do not forget x-default
The x-default value tells Google which page to show when no language or region matches the user, your fallback, often an international English page or a language selector. It is not strictly required, but omitting it is one of the most common oversights, and adding it prevents users who fall outside your defined set from getting a mismatched page. Think of it as the “none of the above” option.
Hreflang must be reciprocal
The single rule that trips people up most: hreflang has to be bidirectional. If your English page points to your French page, the French page must point back to the English one. If page A lists B as an alternate but B does not list A, Google ignores the relationship. Every page in a language set must reference every other page in that set, including itself. On large sites this is where hreflang quietly falls apart, one template misses the return tags and a whole section stops working.
Where to put hreflang tags
You have three options, pick one and be consistent:
| Method | Best for |
|---|---|
| HTML <link> tags in the head | Most sites, easy to implement per page |
| HTTP headers | Non-HTML files like PDFs |
| XML sitemap | Very large sites, keeps markup out of every page |
Do not mix methods for the same pages, and never put hreflang in the body, it must be in the head, the HTTP header, or the sitemap.
Common hreflang mistakes
A handful of errors account for most broken implementations: using the wrong or invalid language codes (it is en-GB, not en-UK); missing return tags so the mapping is not reciprocal; forgetting the self-referencing tag; using relative instead of absolute URLs; and omitting x-default. Each of these can cause Google to silently ignore your hreflang, which is why validation matters.
Generate and check hreflang
Do not hand-write these. Our free hreflang tag generator builds correct tags for every language and region you serve, and the hreflang checker validates a set you already have, flagging invalid codes, missing x-default and duplicates. Run the checker whenever you add a language or migrate the site, the moment a template drops the return tags, hreflang stops working, and the only warning is a slow slide in international rankings.
The takeaway
Hreflang tags map your language and regional page versions so the right audience sees the right page, and so alternates do not compete as duplicates. Use valid language codes, include a self-reference and x-default, keep the mapping reciprocal, and stick to absolute URLs. Build yours with the hreflang generator, validate with the hreflang checker, and browse the rest of our free SEO tools.