What hreflang tags solve
Hreflang tags tell search engines that several URLs are different language or regional versions of the same underlying page, so the right version can be shown to a searcher based on their language and location rather than showing them a version in the wrong language or currency. Without hreflang tags, a site with an English and a Spanish version of the same page risks having search engines treat them as unrelated pages, or worse, as duplicate content competing with each other rather than complementary versions serving different audiences.
Each hreflang tag is a link element with two key parts: a language-region code identifying which version the tag describes, and an href pointing to that specific version's URL. Crucially, hreflang tags are meant to be reciprocal — every page in a set of alternates should include a complete list of hreflang tags pointing to every other version, including itself. This generator builds that complete set for you from the language and URL pairs you enter, so you don't have to hand-write matching tags for every page in the set.
Getting the language-region code right
A language code is typically written in lowercase (such as "en" for English or "fr" for French), while a region code, if included, is written in uppercase and separated by a hyphen (such as "en-US" for US English or "en-GB" for British English). Using just a language code without a region, like plain "en", targets all English speakers broadly regardless of country, which is the right choice if your content doesn't differ by region; adding a region code is only useful when you have genuinely different content for different English-speaking countries, such as different pricing or spelling conventions for the US versus the UK.
The special value "x-default" is reserved for a fallback page shown to searchers whose language or region doesn't match any of your other specified versions — commonly pointed at a language-selector page or your default international version. It's optional, but including it is widely recommended, which is why this generator flags whether one is present in your set.
Common mistakes this generator helps avoid
The two most frequent hreflang mistakes are entering the same language code twice, which creates a genuine ambiguity about which URL search engines should treat as that language's actual version, and forgetting to include a self-referencing tag — a page's hreflang list should include an entry pointing back at its own URL, not just at the other alternate versions. This tool checks for duplicate language codes automatically and flags them, though it's still your responsibility to make sure the resulting tag set is placed identically across every page in the alternate group.
Since hreflang tags are reciprocal, the same generated set of tags should be pasted into the head section of every page listed, not just one — a page whose own hreflang set doesn't match what other pages in the group declare about it can have its hreflang relationships ignored or only partially honored by search engines.