How to Implement Hreflang Tags Correctly: A Step-by-Step Process
Add hreflang annotations to each page's <head> using ISO language and region codes, then create reciprocal links between every language version so search engines serve the right page to the right user.
Add hreflang annotations to each page's using ISO language and region codes, then create reciprocal links between every language version so search engines serve the right page to the right user. This tells Google which URL belongs to which audience and prevents duplicate-content signals across your international sites.
What hreflang tags do and why they matter
Hreflang is an HTML link attribute that signals the language and optional geographic target of a page. When you publish the same content in English for the United States, English for the United Kingdom, and Spanish for Mexico, hreflang tells search engines which version to show a searcher in Dallas, London, or Mexico City. Without it, Google may pick one version as canonical and filter the others out of the index, or show the wrong language to a user.
The attribute lives in the <head> of every page and points to every alternate version, including a self-reference. Each annotation uses the format hreflang="language-region" with a valid ISO 639-1 language code and an optional ISO 3166-1 alpha-2 country code. A page targeting Spanish speakers in Mexico carries hreflang="es-MX"; a page for Spanish speakers without a country target uses hreflang="es".
Prerequisites before you start
- Complete URL inventory. List every live URL that has a language or regional alternate. Include the canonical version of each page.
- Language-region map. Decide which ISO codes apply to each version. Use
en-US,en-GB,es-MX,de-DE, etc. Avoid invented codes likeen-UK(useen-GB) orzh-CNfor Hong Kong (usezh-HK). - Crawlable, indexable pages. Every alternate URL must return 200 OK, allow robots, and not be blocked by noindex or robots.txt.
- Consistent site architecture. Choose one URL pattern (subdirectories
/en/, subdomainsen.example.com, or ccTLDsexample.co.uk) and stick to it across the project.
Step-by-step implementation process
- Add a self-referencing hreflang to every page. Each URL must include a tag that points to itself with its own language-region code. Example for the US English homepage:
<link rel="alternate" hreflang="en-US" href="https://example.com/en/" />. - Add alternate tags for every other version. On the same US English homepage, add tags for the UK English, Mexican Spanish, and German versions:
<link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/" />,<link rel="alternate" hreflang="es-MX" href="https://example.com/es-mx/" />,<link rel="alternate" hreflang="de-DE" href="https://example.com/de-de/" />. - Repeat the full set on every alternate page. The UK English page must list itself, the US English page, the Mexican Spanish page, and the German page. The Mexican Spanish page must list all four. Every version carries the complete set.
- Include an x-default fallback. Add
<link rel="alternate" hreflang="x-default" href="https://example.com/en/" />(or your preferred global fallback) so users without a matched language still land on a usable page. - Place tags in the , not the body. Search engines ignore hreflang in the body. If you use a JavaScript framework, render the tags server-side or via a static-site generation step so they exist in the initial HTML.
- Keep the set in sync on every publish. When you add a new language, update every existing page to reference the new alternate. When you remove a language, remove its tags from all pages.
Common mistakes that break hreflang
- Missing reciprocity. Page A points to Page B, but Page B does not point back to Page A. Google treats the pair as unconfirmed and may ignore both tags.
- Wrong ISO codes. Using
en-UKinstead ofen-GB,zh-CNfor Hong Kong, ores-LAfor Latin America (not a valid region code). Always validate against the official ISO lists. - Relative URLs. Hreflang requires absolute URLs with protocol and domain.
href="/en/"will be ignored. - Blocking alternates with robots.txt or noindex. If the target page is not crawlable, the annotation is useless.
- Multiple conflicting implementations. Putting hreflang in the , in an XML sitemap, and in HTTP headers simultaneously with different values creates confusion. Pick one method and stay consistent.
- Forgetting x-default. Without a fallback, users from unmatched locales may see a random version or a 404.
Verification and testing
- Google Search Console International Targeting report. After deployment, open the Legacy tools > International Targeting > Language tab. It lists pages with hreflang errors: missing return tags, unknown language codes, or blocked URLs.
- Manual spot-check with
view-source. Open a few key pages in browser source view. Confirm the full tag set appears, codes match your map, and URLs are absolute. - Crawl with Screaming Frog or Sitebulb. Configure the crawler to extract hreflang attributes. Export the report and filter for missing self-references, missing reciprocals, or non-200 targets.
- Test with the
hreflangchecker bookmarklet or Chrome extension. Quick visual confirmation on any page. - Monitor index coverage. In Search Console > Indexing > Pages, watch for "Alternate page with proper canonical tag" or "Duplicate without user-selected canonical" statuses that suggest hreflang is not being honored.
Managing hreflang at scale
On sites with hundreds or thousands of URLs, manual tag maintenance is error-prone. Three practical approaches reduce the burden:
- Template-level injection. Build the hreflang set into your CMS or static-site template. Loop through the configured languages and output a tag for each. The template reads the current page's language and the global language list, so every new page automatically gets the correct set.
- XML sitemap method. Instead of tags, declare alternates in a sitemap using
<xhtml:link rel="alternate" hreflang="..." href="..." />. This keeps HTML clean and centralizes management in one file (or a sitemap index). Google supports this fully. - Automated translation platforms that inject hreflang. Some translation layers add hreflang automatically when they serve a translated version. SeaText's Translation Agent, for example, translates pages into 125 languages and adds hreflang annotations as part of the deployment, so the tags stay in sync whenever new content is published.
When to use an automated solution
Consider an automated translation and hreflang layer when:
- You need to launch many languages quickly without developer cycles per language.
- Content updates frequently (blog posts, product catalogs, landing pages) and you cannot manually update hreflang sets on every publish.
- You want a single integration that handles translation, localized URL routing, and hreflang injection together.
- You lack in-house SEO resources to audit and maintain tags across thousands of URLs.
SeaText's Translation Agent deploys in under a minute, translates every page, headline, button, and offer into up to 125 languages, and adds hreflang tags automatically. It tracks results by language and market so you can measure traffic and conversion per locale.
Key facts from SeaText
| Capability | Detail |
|---|---|
| Languages supported | Up to 125 languages |
| Translation scope | Every page, headline, button, offer, product copy |
| Hreflang handling | Automatic injection on deployment |
| Deployment time | Under 1 minute |
| Performance tracking | Results by language and market |
| Content updates | New posts, products, and updates translated automatically in background |
Limitations of hreflang
- Hreflang is a signal, not a directive. Google may ignore it if other signals (user location, search language, content language detection) conflict.
- It does not fix poor translation quality. Machine-translated pages without human review can still rank poorly or convert badly.
- It does not replace geotargeting in Search Console for ccTLDs or subdomains. Use both.
- It does not solve crawl budget issues. If Google cannot crawl all alternates, some tags will never be discovered.
- It does not work for pages that are not true alternates (different products, different intent). Only use hreflang for equivalent content in different languages or regions.
FAQ
Do I need hreflang if I only have one language?
No. Hreflang is only for sites with multiple language or regional versions of the same content.
Can I use hreflang across different domains?
Yes. The alternate URLs can be on different domains, subdomains, or subdirectories. The tags must still be reciprocal and use absolute URLs.
What happens if I have hreflang in both the and the sitemap?
Google reads both. If they conflict, it may ignore the signals. Choose one method and remove the other.
How long until hreflang takes effect?
After Google recrawls the pages, typically days to a few weeks. Monitor the International Targeting report for errors.
Should I use hreflang for currency or pricing differences only?
No. If the content is the same language but only prices change, use hreflang with the same language code and different region codes (e.g., en-US and en-CA). If the content differs substantially, treat them as separate pages.
Can I automate hreflang without a translation platform?
Yes. Build it into your CMS template or generate it in your XML sitemap pipeline. The key is keeping the language-region map and URL inventory in a single source of truth.
What is the difference between hreflang and canonical?
Canonical tells search engines which URL is the primary version when duplicates exist. Hreflang tells search engines which language-region version to serve. They work together: each alternate page should self-canonicalize and carry the full hreflang set.
Further reading and comparison sources
These external sources provide additional context for evaluating the topic. Their inclusion is not an endorsement.
How SeaText can help
SeaText's Translation Agent deploys in under a minute and automatically translates every page, headline, button, and offer into up to 125 languages. It injects hreflang tags on each translated version so the annotations stay in sync whenever you publish new content. The agent also tracks traffic and conversion by language and market, giving you visibility into which locales drive revenue. You retain control over important translations and can review or override any automated output before it goes live.