Hreflang Tag Generator
List each version of a page with its language or language and region code and its full address. Add an optional x-default address for visitors whose language matches none of them. The tool checks the codes and addresses, then writes the output in the format you pick: HTML link tags for the head of the page, an HTTP Link header for files such as PDFs, or XML sitemap entries. Everything runs in your browser.
Paste these lines into the head of every version listed, each version carrying the full set including itself.
<link rel="alternate" hreflang="en" href="https://example.com/en/pricing" /> <link rel="alternate" hreflang="en-GB" href="https://example.com/en-gb/pricing" /> <link rel="alternate" hreflang="de" href="https://example.com/de/preise" /> <link rel="alternate" hreflang="x-default" href="https://example.com/pricing" />
Each version of a page must list itself and every other version, and the other versions must link back, or the tags may be ignored. Addresses are written in full, with https://. A code is a language (en), optionally followed by a script (zh-Hans) and a region (en-GB), and a region cannot stand alone. The optional x-default points to the page to show when no version fits the visitor's language. Use one method per page: link tags, HTTP header or sitemap. Everything runs in your browser.
Related Tools
[5 suggestions]XML Sitemap Generator
Convert a list of URLs into a valid XML sitemap, with URL checks, escaping and optional lastmod, changefreq and priority.
SEO & MarketingMeta Tag Generator
Generate the HTML head tags for a page: title, meta description, canonical, robots, charset and viewport.
SEO & MarketingOpen Graph Generator
Live-generate OG and Twitter Card meta tags for rich social media sharing previews.
SEO & MarketingRedirect Rule Generator
Generate 301 and 302 redirect syntax for Apache .htaccess, NGINX, Next.js, and Cloudflare/Netlify.
SEO & MarketingRobots.txt Generator
Create valid robots.txt files with custom user-agents, allow/disallow paths, and sitemap directives.
SEO & MarketingAbout the Hreflang Tag Generator
Hreflang tells search engines which version of a page is meant for which language and region. Google lists three equal ways to give the information: link tags in the head of the page, an HTTP header, or a sitemap, and says to choose one. Whichever you pick, every version must list itself and every other version, and the other versions must link back, or the annotations may be ignored. A code is a language in ISO 639-1 form such as de, optionally followed by a script such as Hans and a region in ISO 3166-1 alpha 2 form such as GB, as in en-GB or zh-Hans. A region cannot stand alone, so US must be written en-US. The tool tidies the case, rejects a bare country, warns that UK is not the code for the United Kingdom (that is GB, while uk is Ukrainian), flags a code used twice, and requires full addresses that start with https://. The x-default entry takes no language and names the fallback page. Characters such as & in addresses are escaped in the HTML and XML output. The tool checks the format, but it cannot tell whether a language code is one that a search engine supports, so test the live pages as well.
What is hreflang?▾
It is an annotation that tells search engines which language or region each version of a page is for, so that the right version is shown to each visitor. It is given in link tags, in an HTTP header or in a sitemap.
Do I need to list the page itself?▾
Yes. Each version must list itself and every other version, and the other versions must link back. If page A points to B and B does not point back, the annotations may be ignored.
Is the code for the United Kingdom UK or GB?▾
GB. The code en-GB is correct, while en-UK has no effect. Written alone, uk is the language code for Ukrainian. The tool warns about this mistake.
What is x-default?▾
It marks the page to show when no listed version matches the visitor, such as a language selector or a global page. It takes no language code and is optional.
Is my data uploaded?▾
No. The generator runs in your browser and nothing you enter is sent anywhere.