Skip to main content

Hreflang tag generator

Build valid, reciprocal hreflang annotations for your international site - as HTML tags, sitemap entries, or HTTP headers, with x-default and live validation.

  • No signup required
  • 3 output formats
  • Live validation
Free SEO toolHow it works

Language versions

x-default tells search engines which page to serve when no language matches.

3 alternates

<link rel="alternate" hreflang="en" href="https://example.com/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />

Place this full set of tags in the <head> of every listed page (each page must reference all alternates, including itself).

Valid hreflang set with 3 alternates (including x-default).

Don't forget reciprocal tags

hreflang must be reciprocal: every page in the set must link to all the others (and itself). If your English page points to the French one, the French page must point back - or Google ignores the annotations. The set above is the full reciprocal block to place on every listed page.

Launching a multilingual site?

International SEO is easy to get subtly wrong. We build multilingual sites with correct hreflang, sitemaps, and structure from the start.

Talk to an engineer

Quick answer: Hreflang tags tell search engines which language and regional version of a page to serve to which users.

This generator builds valid, reciprocal hreflang markup - as HTML link tags, XML-sitemap entries, or HTTP headers - including the x-default tag, so Google serves the right page to the right audience and you avoid duplicate-content issues.

The three ways to implement hreflang

MethodBest for
HTML link tagsMost sites; simple to add to each page's <head>
XML sitemapLarge sites; keeps markup off the page and scales well
HTTP Link headerNon-HTML files like PDFs

Pick one method per set of URLs - don't mix HTML tags and sitemap entries for the same pages.

Language & region code examples

hreflangTargets
enEnglish speakers, any region
en-USEnglish speakers in the United States
en-GBEnglish speakers in the United Kingdom
fr-CAFrench speakers in Canada
x-defaultFallback when no language matches

Language uses ISO 639-1 (2 letters); region uses ISO 3166-1 Alpha-2 (2 letters). Language is required, region is optional.

The most common hreflang mistakes

  • Missing return (reciprocal) tags - every page must reference all the others, or Google ignores the set.
  • Wrong codes - using a country code as a language (e.g. "uk" for Ukrainian, which is actually "ua" region / "uk" language is Ukrainian - easy to confuse) or inventing codes.
  • No x-default - leaving users with no fallback when their language isn't covered.
  • Relative URLs - hreflang requires absolute, fully-qualified URLs.
  • Non-canonical targets - hreflang URLs should be self-canonical, not pointing at a different canonical.
FAQ

Your questions, answered

Have a question about your project? Ask us on a free call, and we'll give you a straight answer.

What are hreflang tags?
Hreflang tags tell search engines which language and regional version of a page to serve to which users. They prevent duplicate-content issues across translated or country-specific pages and make sure, for example, that a French user sees your French page rather than the English one.
What is the x-default hreflang value?
x-default specifies the fallback page to show when none of your language or region versions match the user. It's commonly used for a language selector page or your primary/global version. It's optional but recommended for most international setups.
Should hreflang go in the HTML, sitemap, or HTTP header?
All three are valid - pick one. HTML link tags in the <head> are simplest for normal pages. The XML sitemap method keeps markup out of your pages and scales well for large sites. The HTTP Link header is used for non-HTML files like PDFs. Don't combine methods for the same URLs.
Do hreflang tags need to be reciprocal?
Yes. Every page in a language set must reference all the others, including itself. If page A links to page B but B doesn't link back to A, search engines treat the annotations as invalid and may ignore them. Missing return tags is the most common hreflang mistake.
What language and region codes does hreflang use?
Use a 2-letter language code from ISO 639-1 (like en, fr, de), optionally followed by a 2-letter region code from ISO 3166-1 Alpha-2 (like en-US, en-GB, fr-CA). The language comes first; the region is optional and should target a country, not a continent.
What is x-default?
The fallback version shown when no language/region matches the user - often a selector page or your global version.
HTML, sitemap, or HTTP header?
All valid - pick one. HTML for normal pages, sitemap for scale, HTTP header for non-HTML files.
Which codes does hreflang use?
ISO 639-1 language (en, fr) optionally with ISO 3166-1 Alpha-2 region (en-US, fr-CA).

Tell us about your project

Tell us what you're building, when you need it, and what's in the way. A senior engineer will reply within one business day with honest next steps, even if that means we're not the right fit.

  • Your project is led by a senior engineer, not a junior and not AI on its own
  • AI speeds up the build. Every change is reviewed and tested before it ships
  • Best for MVPs, SaaS products, automation, and fixing apps that keep breaking
Browse all SEO tools