Hreflang Tag Generator: Build Markup From Your Language-URL Pairs
This hreflang generator builds markup from the language-URL pairs you type in. Add each page version with its language or language-region code and its full absolute URL, then export the cluster in the format you plan to ship: HTML link tags for the head, an HTTP Link header example, or XML sitemap xhtml:link entries. Every exported set includes a self-referencing tag and the matching return tags, so each page in the cluster points to all the others. Choose one method per cluster and stick with it. Once the markup is live, run the URL through our hreflang checker to confirm the deployed pages actually emit it.
How it works
-
Add each version
Enter a language-region code and the absolute URL for every version of the page.
-
Choose x-default
Pick the fallback page for visitors who match none of your versions.
-
Copy the tags
Paste the HTML into every version, or use the XML in your sitemap.
What you get
-
Language-region code check
-
Absolute URL check
Every row needs a full URL beginning with http:// or https://.
-
Duplicate code detection
Codes are compared without regard to case, so en-GB and en-gb count as the same entry.
-
x-default selection
Who it's for
- International SEOs setting up regional English targeting.
- Developers who need correct link tags or sitemap XML without hand-writing them.
- Ecommerce teams running separate US, UK, Australian, and Singaporean storefronts.
- Agency teams preparing hreflang specifications for client sites.
Good to know
Hreflang is a set of annotations, and every page in the set must list all the others and itself.
Get a Free AuditHow to generate hreflang markup from language-URL pairs
Start with one cluster: the set of pages that are translations or regional versions of the same content. In the generator, add one row per version. Each row needs a code, such as en, en-GB, fr-CA or ja, and the full absolute URL of that version, including https:// and the domain. If you have a global page or a country selector, add it as the x-default row. Then pick your export format and copy the output. The tool writes one alternate entry for every row, including the page itself, so the block is complete and bidirectional for that cluster. Repeat the process for each separate cluster rather than mixing unrelated pages into one set.
HTML head tags, HTTP Link header, or XML sitemap: which export to use
All three formats carry the same information, so choose the one that fits how the pages are served. HTML link tags in the head suit most normal websites where you control templates. The HTTP Link header export is for files that have no HTML head, such as PDFs or other downloadable documents, and is set at the server or CDN level. The XML sitemap export, using xhtml:link entries inside each url block, works well for large clusters or many locales, because it keeps the markup out of page templates and is easier to maintain in one place. Pick one method for a given cluster. Running HTML tags and sitemap entries side by side with different URLs or codes creates conflicting signals and makes debugging harder.
Mistakes to catch while you are generating, not after
Most hreflang errors are introduced at the moment the markup is written. Watch for invented codes like en-UK, which should be en-GB, or jp, which should be ja, since language codes follow ISO 639-1 and region codes follow ISO 3166-1 Alpha 2. A region on its own, such as GB, is not valid; it must follow a language. Enter absolute URLs only, because relative paths like /fr/ are not reliably resolved. Do not drop the current page from its own set. Finally, avoid copying the block from one page and pasting it onto a different page without replacing the URLs, which leaves the new page pointing at the wrong alternates and missing its own self reference.
After you paste the generated code: deploy, then validate
The generator produces correct markup from the pairs you enter, but it cannot see your live site. It does not confirm that each URL returns a 200 status, that every version actually ships the same block, or that canonical tags agree. After deployment, test each URL with the hreflang checker, which reads the live tags and reports missing return links and code errors. Hreflang helps search engines show the right regional version to the right users. It is not a ranking boost, and correct markup does not guarantee any position in any market.
Questions
Questions we get asked
Can I paste the same generated block on every page in the cluster?
What URL should I enter as x-default?
Does the generator check that my URLs are live or indexable?
How do I add hreflang to a PDF?
When is the sitemap export better than head tags?
Free audit
Rolling out hreflang across a multilingual site?
Tell us about your locales and setup, and our team will help plan the implementation method, cluster structure, and validation process.
Get a Free Audit