All tools
Interactive generator · free · no signup

Hreflang tag generator

Add a row for each language or region version of your page — code plus URL — choose an x-default, and get the complete set of link rel=alternate hreflang tags to paste into every version's head.

Fallback for users matching no listed language.

Tags for every version’s <head>

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

Every version must include this identical block — each page listing all alternates, itself included, and linking back reciprocally.

How it works

Each row takes an hreflang code and the full URL of that version. Codes follow a strict format: an ISO 639-1 language code (en, de, ja), optionally followed by a hyphen and an ISO 3166-1 Alpha 2 region code (en-GB, de-AT, pt-BR). The tool validates the format as you type, because malformed codes — en-UK instead of en-GB is the classic — are silently ignored by search engines.

You then pick one URL as x-default, the version shown to users whose language matches none of your alternates. The generator outputs the full reciprocal set: every alternate listed, including a self-referencing tag for the page the block will live on. This is the part most implementations get wrong — hreflang only works when every version lists every version, itself included, and each version links back.

Copy the generated block into the head of each language version. The output is identical across versions by design, which is exactly what the reciprocity requirement demands. Generation happens entirely in your browser.

Assumptions and limitations

Frequently asked questions

Does every page really need to list itself in hreflang tags?

Yes. The self-referencing tag is required for the cluster to be valid — each page must list all alternates including its own URL. Omitting the self-reference is one of the most common reasons hreflang silently fails, which is why this generator always includes it.

What is x-default and do I need it?

x-default names the fallback page for users whose language or region matches none of your alternates — often a global homepage or a language selector. It is optional but recommended, especially when your alternates are region-specific and a searcher from an unlisted country needs somewhere sensible to land.

Why are my hreflang tags being ignored by Google?

The usual suspects are missing return tags (page A lists B, but B does not list A), invalid codes like en-UK, alternates that redirect or return errors, and tags pointing at noindexed pages. Fix reciprocity first — it is the requirement that breaks most often, since it spans multiple pages and deploys.

Can I use hreflang for language only, without a region?

Yes, and often you should. A bare ISO 639-1 code like es targets all Spanish speakers regardless of country, while es-MX targets Mexico specifically. Only add region codes when the content genuinely differs by country — pricing, currency, legal terms — otherwise language-only codes are simpler and less error-prone.

Are the URLs I enter into this generator sent to a server?

No. The tag set is built entirely client-side in your browser. None of the URLs or codes you enter are transmitted, logged, or stored anywhere.