hreflang tags without the mistakes
List your languages, paste the URLs for each in the same order, and get matching tags for every page or a sitemap with the alternates built in.
Build hreflang tags
The rules the builder follows
What makes hreflang work
- Every version lists every other version and itself
- Full addresses only, starting with https://
- Valid ISO language codes, with an optional ISO country code
- Each URL used once per language
- An optional x-default for everyone else
Questions
hreflang questions
What is hreflang for?
It tells search engines which pages are language or country versions of each other, so a visitor in Spain is shown the Spanish page and a visitor in the UK the English one, instead of whichever version ranks best.
Does every page need to list itself?
Yes. Each language version must list every version, including itself, and the tags must match on every page in the set. If page A points to page B but B does not point back, search engines ignore the pair. The builder writes identical blocks for every page in a set, so this is always right.
What is x-default?
The page to show visitors whose language you do not cover, often a language chooser or the English version. It is optional but recommended.
Should I use en-UK?
No. The country code for the United Kingdom is GB, so British English is en-GB. The builder checks every language against ISO 639-1 and every country against ISO 3166-1 and points out mistakes like this.
Tags or sitemap?
Either works. Tags in the head of each page are easiest to check, while the sitemap suits sites where editing every page is awkward. Use one method, not both.