Plain definition
Definition of Hreflang Attribute
An HTML, HTTP header, or XML sitemap annotation that tells search engines which language and regional variant of a page to serve to users searching from a matching locale.
<link rel="alternate" hreflang="en-gb" href="https://example.com/en-gb/pricing" /> | Fallback: hreflang="x-default"Worked example
Imagine a made-up payroll app called LedgerMint serves three localized pricing pages: US English at https://ledgermint.example/en-us/pricing, UK English at https://ledgermint.example/en-gb/pricing, and German at https://ledgermint.example/de/pricing, plus a language-picker landing page at https://ledgermint.example/pricing. To prevent UK visitors from seeing dollar pricing in Google results, LedgerMint declares hreflang annotations using ISO 639-1 language codes and optional ISO 3166-1 Alpha 2 region codes.
Per Google Search Central's localized-versions guide, LedgerMint can deliver these annotations in one of three equivalent ways: <link rel="alternate" hreflang="..."> tags in the HTML head, Link HTTP response headers (especially useful for non-HTML files such as PDFs), or xhtml:link entries inside an XML sitemap. Crucially, every localized page must list itself and link bidirectionally to its counterparts, alongside an hreflang="x-default" fallback pointing to the selector page for unmatched locales. If /en-gb/pricing points to /de/pricing without /de/pricing pointing back, Google ignores the annotation.
Why it matters when you launch
Most v1 SaaS products ship in English only, and if you serve a single language you do not need hreflang tags at all. The attribute becomes critical as soon as you translate your landing pages, localize currency and VAT copy across countries, or publish region-specific documentation under subdirectories like /de/ or /es/.
Without proper hreflang pairing, search engines may treat your US and UK pricing pages as near-duplicates, fold them under one canonical URL, and show the wrong currency snippet to international buyers. Implementing clean, automated return links in your Next.js metadata generator prevents international traffic leakage from day one of localization.
Common mistakes
- Omitting bidirectional return links between alternate pages, which causes Google to discard the hreflang mapping entirely to block cross-site spoofing.
- Forgetting the self-referencing hreflang entry on each localized page or using relative paths instead of full absolute HTTPS URLs.
- Using invalid country codes such as "en-uk" instead of the ISO 3166-1 Alpha 2 code "en-gb," or writing a country code alone without a language prefix.
- Pointing every regional variant's rel="canonical" tag back to the English version instead of giving each localized URL its own self-referencing canonical.
Tools and guides that use it
Free tool
Meta Tag GeneratorPreview your Google result and social cards, and copy the tags for Next.js or HTML.Free tool
Live Launch Readiness CheckerInspect any live URL for HTTPS, title, meta description, canonical, Open Graph cards, JSON-LD and AI search crawler access.Founder guide
SEO for Next.js SaaS Sites: App Router Setup Guide (2026)Configure Next.js App Router metadata, canonicals, static prerendering, sitemaps, sanitized JSON-LD, Open Graph images, and Search Console verification for an indie SaaS.Founder guide
Canonical URLs and Redirects for SaaS Sites (2026)How Google picks canonical URLs, when to use 301/308 versus 302/307 redirects, and how to prevent www, trailing-slash and UTM duplicates from splitting signals.Related glossary terms
Official sources
Pritam Ghosh runs Hauntboard and maintains this glossary.
Published · Updated
Building something real? Launch it in public.
A person reviews every launch on Hauntboard, and every view and visit it sends your site is published on your launch page. Free to submit.