// Free Tool · Technical SEO

Hreflang Tag Generator

Generate valid hreflang link tags for every language and region version of your page, then copy the full reciprocal set in seconds.

International SEO

Hreflang Tag Generator

Add each language/region version of your page, get the full reciprocal set of hreflang tags

Page versions
Language = ISO 639-1 two-letter code (en, de, fr). Region is optional = ISO 3166-1 alpha-2 country code (us, gb, mx). Both are lowercased automatically.

x-default
The page Google serves when no language/region version matches the user. Usually your global or English-language homepage.
Waiting for input
Quick presets

What is a hreflang tag generator?

A hreflang tag generator is a free tool that builds the <link rel="alternate" hreflang="..."> tags that tell Google which language and region version of a page to serve to which user. Each tag pairs a language code with a page URL — the language is an ISO 639-1 two-letter code (such as en or de), optionally followed by an ISO 3166-1 alpha-2 region code (such as en-us or en-gb), all in lowercase by Google’s convention. The tool also adds an hreflang="x-default" tag for users whose language does not match any version. A correct hreflang set must be reciprocal and self-referential — every version lists every other version, including itself. This generator produces that full set for you, and it runs 100% in your browser, so nothing you type is ever sent to a server.

How to Generate Hreflang Tags: Step by Step

Hreflang annotations let you target the right language and region without creating duplicate-content problems between near-identical pages. Here is how to build a valid set.

1

Add Every Version of the Page

Click "Add version" and enter the full URL of each language or region variant of the same page. Add one row per version — for example, your English page, your German page, and your French page.

Tip: Use absolute URLs (starting with https://) and the canonical address of each version. Hreflang and canonical tags should point at the same URL for each page.
2

Set the Language and Region Codes

For each version, enter the language as a two-letter ISO 639-1 code, and optionally a region as a two-letter ISO 3166-1 alpha-2 country code. The tool lowercases both and joins them as language-region, for example en-gb. Use language alone (en) to target a language regardless of country.

Tip: The region is a country code, not a language. The United Kingdom is gb, not uk — the tool warns you if you enter uk.
3

Add an x-default URL

Enter the URL Google should serve when no language or region version matches the visitor — usually your global or English-language homepage. This becomes the hreflang="x-default" tag. It is optional but strongly recommended.

4

Review the Validation Notices

The tool checks for common mistakes as you type — an invalid or empty language code, the uk/gb mix-up, or a duplicate language-region pair. Fix any warnings before you publish, because an invalid entry is ignored and the affected version may not be served correctly.

5

Copy the Tags onto Every Page

Click "Copy" and place the full block in the <head> of every version listed — the set must be reciprocal and self-referential, so each page carries the same tags including a link to itself. You can also serve the same set in your XML sitemap or HTTP headers instead.

Tip: Use one method only — either HTML head tags, sitemap annotations, or HTTP headers — and keep the set identical on every page. Mixing methods or omitting the self-reference is the most common cause of hreflang errors.

Frequently Asked Questions

What is a hreflang tag?
A hreflang tag is a <link rel="alternate" hreflang="..."> annotation that tells search engines which language and region a given URL is intended for. It lets you show searchers the version of a page that matches their language or country, and it prevents near-identical translated or localized pages from competing with each other as duplicate content. Hreflang is supported by Google; other search engines handle language targeting differently.
What format should the hreflang value use?
The value is a language code, optionally followed by a region code, in the form language-region. The language is an ISO 639-1 two-letter code such as en, de, or fr. The optional region is an ISO 3166-1 alpha-2 country code such as us, gb, or mx. So en-gb means English as used in the United Kingdom. Codes are case-insensitive, but Google’s convention is lowercase. The special value x-default marks the fallback page for unmatched users.
Do hreflang tags need to be reciprocal?
Yes. Hreflang annotations must be reciprocal and self-referential. If page A lists page B as an alternate, page B must list page A in return, and every page must also include a link to itself. If the return tag is missing, search engines may ignore the annotation entirely. That is why this tool outputs the complete set — you place the same block on every version of the page, including a self-referencing tag.
Should I use uk or gb for the United Kingdom?
Use gb. The region part of a hreflang value is an ISO 3166-1 alpha-2 country code, and the code for the United Kingdom is GB, not UK. Writing en-uk is one of the most common hreflang mistakes — it is invalid and is ignored. The correct value for British English is en-gb. This tool flags uk automatically so you can correct it.
Where do I put hreflang tags?
You can implement hreflang in one of three places: as <link> tags in the HTML <head> of each page, as annotations in your XML sitemap, or as HTTP Link headers (useful for non-HTML files such as PDFs). Pick one method and use it consistently — do not mix methods for the same set. Whatever method you choose, the full set of alternates must appear for every version of the page.
What is the x-default hreflang value?
The x-default value marks the page a search engine should serve when none of your language or region versions matches the user’s settings. It is typically a language selector page or your global or English-language homepage. While optional, including x-default is recommended because it gives Google a clear fallback instead of guessing, which improves how international users are routed to your content.

More free tools: browse the full catalog →