This article addresses how to correctly configure hreflang annotations for multilingual websites. It covers the syntax of language tags, the selection process using registry tools, and practical steps for implementation without relying on specific vendor documentation.
Defining the Scope of Multilingual Page Declarations
Imagine a hypothetical launch team preparing a product catalog for three distinct markets: the United States, France, and Japan. The lead editor drafts a simple spreadsheet to map out which pages should point to each other using hreflang annotations. This is not a real client file but a constructed scenario to illustrate how one might define the scope of these declarations before touching any code.
The first column lists the primary English page title: "Premium Coffee Beans". The corresponding hreflang value is set to en-US. The second column contains the French equivalent, titled "Grains de café premium", with the annotation fr-FR. The third entry is the Japanese version, labeled "プレミアムコーヒー豆", marked as ja-JP. These specific titles and tags are invented solely for this explanation to show how language and region codes pair together in a planning document.
A common choice arises when deciding whether to include an x-default tag. In this example, the team selects x-default for a generic landing page that does not target a specific country. The rationale is straightforward: if a user from Brazil visits the site, the system needs a fallback option rather than forcing them into the US or French versions. This decision highlights how scope definition involves identifying both specific regional variants and a neutral catch-all. The spreadsheet rows demonstrate that each URL must have a reciprocal link back to every other variant in the group. For instance, the US page links to the French and Japanese pages, while the French page links back to the US and Japanese ones. This mutual referencing ensures the search engine understands the relationship between all listed items. By listing these concrete entries and the explicit choice for the default page, the team clarifies exactly which pages are part of the multilingual cluster before implementation begins.
Understanding Language Tag Syntax and Structure
Language tag syntax is defined by the IETF's BCP 47, and the latest RFC describing that syntax is RFC 5646, which obsoletes the older RFCs 4646, 3066 and 1766. In this article, the value of a language attribute such as fr-CA is called a language tag, and fr and CA are its subtags when described as parts of a tag; as members of an ISO list, they are called codes.1
Most language tags consist of a two- or three-letter language subtag, often followed by a two-letter or three-digit region subtag. All language tags must begin with a primary language subtag, and any script subtag must immediately follow the language or extlang subtag. Examples given include en for English, fr-CA for French as used in Canada, es-419 for Spanish as used in Latin America, and zh-Hans for Chinese written with Simplified script. The stated golden rule when creating language tags is to keep the tag as short as possible, avoiding region, script or other subtags except where they add useful distinguishing information.1
For HTML and XML, the lang attribute specifies language tags in HTML and xml:lang for XML, and language information is inherited by elements inside the one where the declaration was made unless an element declares a different language. Case should not matter for HTML and XML language markup, and the empty string can prevent inheritance.1
Before drafting any annotation, you can start with the lead editor's spreadsheet for the three-market catalog and add a plain-language column that records the language and region actually in use for each page. For the English page intended for readers in the United States, you might note “English — United States” as your intent, then compare it with “English” alone; deciding whether the regional signal is meaningful for that page is the first choice to settle. For the French page, consider whether it serves France specifically or French readers more broadly, and record which interpretation your content supports. The Japanese page raises a similar question about audience scope.
Once those intents are written down, you can turn one row into an illustrative tag: a language subtag followed by a region subtag, such as en-US for the United States page, fr-FR for a France-specific page, or ja-JP for the Japan page. You might also try a shorter tag, such as en or fr, and ask whether it implies a broader audience than the page actually addresses. Reading each candidate aloud against the page's intended readers helps reveal mismatches before the values appear in markup.
You can then review the spreadsheet as a set of choices rather than a finished specification. Check that each page's recorded intent matches its proposed tag, and flag rows where the region is unclear.
Selecting Primary Subtags via Registry Search
A registry search for a language name returns a record whose Description field matched the query, such as the French entry. Confirm that the record’s Type is language, then take the value in the Subtag field, here fr, as the primary language subtag. The registry also provides the Language Subtag Lookup tool as an additional search aid, and the registry file itself can be searched by language name.2
The source notes that the choice is not always straightforward. It cites the case of Punjabi in Pakistan, whose code is lah, and warns that the same name may refer to different languages or a searched name may not appear. For such cases it points to the SIL Ethnologue cross-referenced with Wikipedia, noting that Ethnologue uses the same three-letter codes as BCP 47 but that two-letter BCP 47 codes need conversion to their ISO 639-3 counterpart, a conversion the Language Subtag Lookup tool performs.2
You can start by rewriting the target-suffix column for the three-market catalog so each row shows a chosen language tag instead of a vague location. For example, the row that previously said “English, US” could become a candidate choice labeled en-US; the France row might become fr-FR, and the Japan row ja-JP. Keep the primary English title “Premium Coffee Beans” beside the en-US row, and note in a short remark that these candidates reflect the team’s intent for each market, not a finished specification.
When the same catalog needs an archived notice as well as a current one, you can reuse those fields but fill them differently. For the current announcement, you might write the title “Premium Coffee Beans — Current Release,” record its intended audience, and assign the candidate tag en-US. For the archived notice, you might write “Premium Coffee Beans — 2023 Archive,” record that it serves readers who follow older material, and consider whether a plain language subtag such as en fits better than a region-specific one. You can note the reason for each choice in the remark column.
Consider keeping a question beside each tag: does the recorded audience match the tag, and does the archived row stay distinct from the current one? You might also mark any row where two candidate subtags seem equally plausible, then choose one and write down why.
Applying Case Conventions and Regional Codes
For the region part of a tag, the source states that region subtags must follow any language or script subtags, and should be used only when the region adds information needed to distinguish one tag from another; otherwise it should be left out. It gives en-GB as possibly useful for spell-checking, while the region in ja-JP is unlikely to be useful unless intentionally contrasted with Japanese used elsewhere. It lists two region-subtag types: 2-letter codes and 3-digit codes, the latter tending to identify multinational regions, as in es-ES for Spanish in Spain and es-419 for Spanish in Latin America. Deprecated subtags should be avoided, with the registry normally naming a replacement in the Preferred-Value field.2
You can take the three-market catalog sheet and add a short “case check” column beside each proposed tag, recording how the casing in your own draft compares with the tag you intend to publish. For example, a row marked en-US alongside a page title written as “Premium Coffee Beans” gives you a concrete pair to inspect; if another row shows EN-us or en_us, you might note the mismatch and decide whether to normalize it before the sheet goes to anyone else. This is a choice you can make row by row rather than a rule imposed on the whole file.
Regional codes deserve the same treatment, because a country subtag can look precise while still being the wrong scope for the material. You could write a plain question next to each region entry—does this page actually serve readers in that country, or is it merely written in that language?—and leave the answer blank until the editor confirms it. If a row for France carries fr-FR while the page itself is a generic French landing page, you can flag it for a second look instead of silently accepting it. Keeping these notes in your own working copy lets you revisit the case conventions and regional choices later without treating the spreadsheet as final.
For an archived notice reused from the same catalog, you can repeat the fields but fill the case check with the archive’s own tag, then compare it against the current row. A quick side-by-side of the two records, written in your own words, helps you decide which version the annotation should describe and keeps the two entries from being confused.
Minimizing Tags for Clear Distinction
For the catalog's language-only needs, the source states the golden rule is to keep a language tag as short as possible and add further subtags only when needed to distinguish the language from something else in that context. Region subtags must come after any language or script subtags, and should be used only if they contribute information needed to distinguish one tag from another. The source's own example notes that en-GB might be a useful distinction for spell-checking, but the region subtag in ja-JP is unlikely to be useful unless intentionally contrasted with Japanese spoken elsewhere. Script subtags likewise should appear only when the script adds useful distinguishing information, such as a language written in more than one script; where a language subtag carries a Suppress-Script field, the script subtag should not be used.2
You can take the same three-market catalog sheet and add a short “tag balance” column beside each proposed annotation, recording whether every page needs its own full set of return links or whether a simpler shared set would still make the relationships clear. For the current announcement in the hypothetical example, you might write a note such as “each market page points to the other two plus the generic landing page,” while for the archived notice you could write “archive points only to its own language variants, not to live pages.” The point is to let you see, row by row, where the tags grow dense and where a reader could lose the thread. You might then decide to trim a redundant cross-link or keep it, noting your reason beside the entry rather than treating the larger set as automatically better.
A second optional check is to count the distinct language and region pairs your sheet now contains. If two rows resolve to what is effectively the same audience, you can consider merging them in the draft before any annotation is written, or mark one as intentionally separate with a brief note. This keeps the eventual set small enough that a reviewer can follow each link without a map. When you compare the current and archived entries, you can ask whether the archived row still earns its place in the shared set, or whether its own narrower group of targets reads more clearly. Writing down that choice, even as a single line, lets you revisit it before the sheet becomes a specification.
Verifying Annotations Against BCP 47 Standards
BCP 47 defines language tag syntax, and its current specification is RFC 5646, which replaces RFCs 4646, 3066 and 1766. Subtags can be checked in the IANA Language Subtag Registry, and the registry marks some entries as redundant or deprecated, which the source advises avoiding; certain variant subtags must also be combined with prescribed subtags.1
The source gives a compactness rule: keep tags as short as possible and omit region or script subtags unless they add useful distinction. It illustrates this with ja for Japanese rather than ja-JP, and it recommends yue over zh-yue for Cantonese where possible. For scripts, a registry Suppress-Script field discourages a script subtag, as with es; zh-Hans and zh-Hant remain available where script distinguishes Simplified from Traditional Chinese.1
You can take the three-market catalog sheet and compare each proposed tag against the letter and casing conventions you intend to follow, using a short BCP 47 reference list rather than memory alone. For the French row, the editor may have typed fr-fr; on review, the reference shows region subtags conventionally appear in uppercase, so the row becomes fr-FR. That revision is a writing choice, not a claim about how any tool will behave.
With the casing check in place, you might add a column recording which subtags you can justify for each row. The en-US row is easy to explain: language plus region, both drawn from the intended audience. The Japan row invites a decision—whether the audience is better described by language alone or by language and region together—and the editor can note the reason either way, since the sheet is a record of intent rather than a finished standard.
Archived entries can reuse the same comparison. If the archived French notice serves the same audience as the current one, the tag stays fr-FR; if it was written for a broader audience, the editor might choose fr alone and record why. You can keep both rows side by side so the difference in scope is visible before any page markup is drafted.
Frequently asked questions
How can I start a spreadsheet to record the language and region actually in use for each page before drafting annotations?
Before drafting any annotation, you can start with the lead editor's spreadsheet for the three-market catalog and add a plain-language column that records the language and region actually in use for each page. For the English page intended for readers in the United States, you might note “English — United States” as your intent, then compare it with “English” alone; deciding whether the regional signal is meaningful for that page is the first choice to settle.
How can I add a case check column beside each proposed tag and note casing mismatches in my draft?
You can take the three-market catalog sheet and add a short “case check” column beside each proposed tag, recording how the casing in your own draft compares with the tag you intend to publish. For example, a row marked en-US alongside a page title written as “Premium Coffee Beans” gives you a concrete pair to inspect; if another row shows EN-us or en_us, you might note the mismatch and decide whether to normalize it before the sheet goes to anyone else.
How can I add a tag balance column to record whether each page needs a full set of return links or a simpler shared set?
You can take the same three-market catalog sheet and add a short “tag balance” column beside each proposed annotation, recording whether every page needs its own full set of return links or whether a simpler shared set would still make the relationships clear. For the current announcement in the hypothetical example, you might write a note such as “each market page points to the other two plus the generic landing page,” while for the archived notice you could write “archive points only to its own language variants, not to live pages.”