About the Hreflang Language & Country Code Validator
Hreflang values follow a strict pattern: a two-letter ISO 639-1 language code, optionally followed by a two-letter ISO 3166-1 region code, as in hi-IN or en-GB, or the special value x-default. A script subtag such as zh-Hant is also allowed. Small mistakes are common. en-UK looks right but is invalid because the region code for the United Kingdom is GB, and region-only values such as IN are not allowed because the language is always required.
This hreflang language code validator checks a list of codes in your browser, explains each mistake in plain language and includes a searchable reference of language and country codes. Validate codes before building tags with the hreflang generator, especially when a CMS or translation plugin lets editors type codes by hand.
How to use it
- Paste the hreflang codes you plan to use, one per line.
- Review each code's validity and any explanation.
- Search the reference list to find the correct codes.
- Use the corrected codes in your tags or sitemap.
Frequently asked questions
Why is en-UK not a valid hreflang code?
The region part must be an ISO 3166-1 alpha-2 country code, and the code for the United Kingdom is GB, not UK. The correct value is en-GB. Search engines may ignore annotations with invalid codes, so it is worth checking every value.
Can I use only a country code in hreflang?
No. A language code is always required. You can use a language on its own, such as hi for Hindi, or a language plus region, such as hi-IN, but a region on its own, such as IN, is not valid.
Which code should I use for Hindi and English pages in India?
Use hi-IN for Hindi content aimed at India and en-IN for English content aimed at India. If the same English page serves all countries, plain en is enough. Add a region only when you have different versions for different countries.