Hreflang Tag Builder
Generate hreflang tags for multilingual and multi-regional SEO. HTML and XML sitemap output. 100% client-side.
How to Use the Hreflang Builder
- Choose a preset or start with Custom to manually add languages.
- Add language rows — select a language, optional region, and enter the URL for that version of your page.
- Add x-default — designate a fallback URL for users whose language does not match any hreflang entry.
- Click Generate — the tool outputs HTML link tags or XML sitemap entries, ready to copy.
- Toggle HTML / XML Sitemap format using the buttons above the output.
What Are Hreflang Tags?
Hreflang tags are HTML attributes used in <link rel="alternate"> elements that tell search engines which language and regional version of a page to serve to users in different locales. Implemented properly, hreflang tags ensure that a French-speaking user in France sees the French version of your page in Google search results, while an English-speaking user in the United States sees the English version.
The hreflang attribute uses a standardized format: hreflang="xx" for language-only targeting (e.g., en for English) or hreflang="xx-yy" for language-and-region targeting (e.g., en-us for American English, en-gb for British English). Language codes follow ISO 639-1 and region codes follow ISO 3166-1 Alpha-2.
Why Hreflang Tags Matter for International SEO
Without hreflang tags, search engines may display the wrong language version of your page to users, or treat your translated pages as duplicate content. This can lead to the wrong URL ranking in the wrong country, diluted ranking signals across multiple language versions, and a poor user experience for international visitors. Hreflang tags solve all of these problems by creating an explicit mapping between language versions.
The x-default Value
The special hreflang="x-default" value designates a fallback page for users whose language or region does not match any of the other hreflang entries. This is typically set to a language selector page or the main default version of your site (usually English). While optional, including x-default is strongly recommended as a best practice.
Implementation Methods
There are three ways to implement hreflang tags. You only need one:
- HTML link tags — placed in the
<head>section of each page. This is the most common and straightforward approach. Each page in the set must include link tags for all other language versions plus a self-referencing tag. - XML sitemap — hreflang annotations are added to your XML sitemap using
<xhtml:link>elements. This approach is better for very large sites with many language versions, as it avoids adding many link tags to the HTML. - HTTP headers — used for non-HTML resources (PDFs, documents). The
LinkHTTP header specifies alternate language versions.
Common Hreflang Mistakes
- Missing self-reference — every page must include a hreflang tag pointing to itself. Without it, search engines may ignore the entire set.
- Missing return links — hreflang must be reciprocal. If page A points to page B, page B must point back to page A. One-directional references are ignored.
- Wrong language/region codes — use ISO 639-1 for languages and ISO 3166-1 Alpha-2 for regions. Common mistakes include using
en-uk(should been-gb) orjp(should beja). - Duplicate language codes — each language-region combination should appear only once in the set. Duplicates create conflicting signals.
- Missing x-default — while technically optional, omitting x-default means there is no fallback for unlisted languages, which may result in poor user experience.
Presets
This tool includes presets for common international setups: English (US/GB) for targeting American and British audiences, European (EN/ES/FR/DE/IT) for covering major European markets, and Asian (EN/JA/KO/ZH) for targeting East Asian markets alongside English. Each preset pre-fills the language and region fields so you only need to enter your URLs. For a complete international SEO workflow, combine hreflang tags with our Canonical Checker to avoid duplicate content, our Meta Tag Generator for localized meta tags, and the Slug Normalizer for consistent URL formatting.