Boneyard Tools

Hreflang Tag Generator

Add one row per language or region with its page URL and get a ready-to-paste block of hreflang link tags. Set an optional x-default for users whose language you do not target, and every href is escaped for you.

How to generate hreflang tags

  1. Add a row for each localized page with its language code (like en-US) and full URL.
  2. Optionally set an x-default URL for visitors whose language you do not match.
  3. Copy the generated tags and paste them inside the <head> of every page in the set.

Examples

English and Spanish pages

en-US: https://example.com/, es-ES: https://example.com/es/
<link rel="alternate" hreflang="en-US" href="https://example.com/" />
<link rel="alternate" hreflang="es-ES" href="https://example.com/es/" />

Adding an x-default fallback

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

Frequently asked questions

What do hreflang tags do?

They tell search engines which version of a page to show for a given language and region. If you have the same content in English, Spanish and French, hreflang links the three versions so each is served to the right audience instead of competing with each other.

What is the x-default value for?

x-default marks the page to show when no other language or region matches the user. It is commonly used for a language selector or a global landing page. It is optional, but recommended when you target several languages.

Do hreflang tags need to be reciprocal?

Yes. Every page in a set should list all the alternates, including a self-referencing tag pointing to itself. If page A points to page B but page B does not point back to A, search engines may ignore the annotations entirely.

What format should the language code use?

Use a two-letter ISO 639-1 language code such as en or de, optionally followed by a hyphen and a two-letter ISO 3166-1 region code such as en-US or pt-BR. This tool flags codes that do not match that loose pattern so typos are caught early.

What are the most common hreflang mistakes?

The frequent ones are using an underscore instead of a hyphen (en_US), forgetting the self-referencing tag, listing relative instead of absolute URLs, and leaving the set non-reciprocal. Pages should also return a 200 status, not redirect to one canonical version.

Is my input sent to a server?

No. The tags are built entirely in your browser with JavaScript, so the languages and URLs you enter are never uploaded or stored.

Related tools