DELTAWEB
All posts
Technical SEO

Script Codes in hreflang: zh-Hans, zh-Hant, sr-Latn Guide

When should hreflang use script subtags like zh-Hans, zh-Hant or sr-Latn? BCP 47 rules, region pairing, common errors and safe examples for exporters.

Script Codes in hreflang: zh-Hans, zh-Hant, sr-Latn Guide
8 minReading time
Arif KuruAuthor

Imagine a Turkish machinery exporter that launches its Chinese page and writes only "zh" in the hreflang tag. A buyer in Taiwan then lands on the version meant for Hong Kong (hypothetical example). Confusion like this can often be reduced by adding a script subtag or choosing the right region code. This article explains when script codes such as zh-Hans, zh-Hant and sr-Latn are needed, what the BCP 47 rules say, and what Google's hreflang documentation does and does not cover. For the broader picture, start with our complete hreflang guide.

Key Takeaways

  • zh-Hans (Simplified Chinese) and zh-Hant (Traditional Chinese) are script subtags added to the language code. They describe the writing system.
  • sr-Latn and sr-Cyrl separate the Latin and Cyrillic forms of Serbian, which helps when you target one writing system of the same language.
  • A script code carries no country information. If you need a country target, add a region code such as TW, HK or RS.
  • Google's hreflang documentation describes the language-region format and makes no firm promise about how script subtags are processed. Verify with your own tests.
  • Return tags and the x-default decision apply whether or not you use script codes.

What BCP 47 is and how a language tag is read

BCP 47 (IETF RFC 5646) is the standard that defines how language tags are written on the internet. A tag is built from subtags: first a language code (ISO 639, for example zh or sr), then an optional script code (ISO 15924, four letters, for example Hans, Hant, Latn or Cyrl), and then an optional region code (ISO 3166, for example TW or RS). The general form is language-script-region, and only the parts you need are included.

This structure exists for cases where the same language has more than one writing system. Simplified Chinese is common in mainland China, while Traditional Chinese is common in Taiwan, Hong Kong and Macau. Serbian is written in both Latin and Cyrillic.

Language, script and region: three separate layers

Mixing up these three layers is one of the most frequent errors. The language code says which language the content is in, the script code says which alphabet it uses, and the region code says which geography it targets. For example, zh-TW is a region-based tag that points to Chinese content aimed at Taiwan. zh-Hant points to Traditional script, and it does not say which country the page is meant for.

What Google's hreflang documentation says, and what it leaves out

Google's hreflang documentation describes the language value in ISO 639-1 format and the optional region value in ISO 3166-1 Alpha-2 format. The most common forms are therefore language-region combinations such as en, en-GB or fr-CA. The documentation does not explicitly discuss script subtags such as zh-Hans or sr-Latn.

This is not a prohibition, but it is not a guarantee either. The official documentation does not give a firm rule for how a value like zh-Hans or sr-Latn is interpreted, so we treat that point as uncertain here. The practical advice is to watch which page Search Console associates with which language and region before you rely on script codes, and to record your observations in writing.

zh-Hans or zh-Hant: which one to choose and when

The choice depends on which writing system your audience reads. The table below gives a general frame; confirm country-specific preferences with market research.

AudiencePossible valueNote
Mainland China, Simplified scriptzh-Hans or zh-CNzh-Hans if the target is the writing system; zh-CN if the target is the country
Taiwan, Traditional scriptzh-Hant-TW or zh-TWAdd the region code if you want a country target
Hong Kong and Macau, Traditional scriptzh-Hant-HK or zh-HantSeparate pages can be created if local preferences differ

One distinction matters here: zh-Hans is a writing-system preference, not a country preference. It may also suit Simplified Chinese readers in Singapore. If you have no country target, using the script code alone is a reasonable choice. If you do have a country target, consider adding the region code as well.

sr-Latn and sr-Cyrl: choosing a script for Serbian

Serbian is written in both Latin and Cyrillic. For these two writing systems the BCP 47 values are sr-Latn and sr-Cyrl. If you offer a Latin-script version to users in Serbia, sr-Latn-RS is a natural choice, while a Cyrillic version could be marked sr-Cyrl-RS. For Bosnia and Herzegovina, options such as sr-Latn-BA or simply sr-Latn should be weighed against your audience.

Writing only "sr" does not show which alphabet is meant. Where Latin script is common, sr-Latn is a clearer signal. Still, check that the tag matches the real writing system of the page. If tag and content disagree, the problem is the labeling, not the script code itself.

Combining a script code with a region code

BCP 47 allows both a script and a region subtag, and the order matters: language, script, region. So zh-Hant-TW is valid, while zh-TW-Hant is not. The practical rule is that every combination should map to a page pair that actually exists on your site and that points back to its counterpart with a return tag.

Example (hypothetical)ValueAssessment
General Chinese page focused on the writing systemzh-HantCovers readers in Taiwan and Hong Kong together
Price and delivery page aimed at Taiwanzh-Hant-TWThe country target is explicit
Latin-script page for Serbiasr-Latn-RSLanguage, script and country are all stated

Common mistakes

  1. Using underscores: values such as zh_Hans do not follow the BCP 47 format. The correct form is zh-Hans.
  2. Inconsistent casing: BCP 47 is case-insensitive, but for consistency write the script part in title case: Hans, Hant, Latn, Cyrl.
  3. Writing language names: "chinese" or "serbian" are not valid values. Use the language code.
  4. Mismatching script and content: serving Simplified content on a page tagged zh-Hant sends users to the wrong version.
  5. Skipping return tags: if page A points to B but B does not point back to A, the pair does not match. Script codes do not change this rule. For details, see our hreflang return tag errors article.
  6. Unnecessary length: adding long combinations to every page when no region is needed increases both error risk and maintenance work.

Where x-default fits

If a page matches none of the target language variants, the x-default value is used to point to a neutral selector or fallback page. The same logic holds when script-coded values are in use. For the full details of x-default decisions, see our hreflang x-default guide.

Pre-publication checklist

  • Is every value in BCP 47 form (language-script-region order, no underscores)?
  • Does the script code match the real writing system of the page?
  • Does the region code reflect a real country target, or is it unnecessary?
  • Is every pair reciprocal, with return tags on all variants?
  • Are the values consistent with your sitemap or page source?
  • Have you recorded your market-based decisions in writing?

To run these checks across the whole site, you can also add the hreflang error section of our international SEO guide to your checklist.

Open questions

Three points cannot be settled as firm rules in this article. First, the official documentation does not explicitly define how Google treats script subtags in hreflang. Second, whether zh-Hant or zh-TW gives the stronger signal can vary with your site and search behavior. Third, the choice between Latin and Cyrillic for Serbian may differ from market to market. There is no universal answer to these questions, so base decisions on your audience data and on how your pages actually behave, and keep checking the current interface and documentation.

How to verify the values on the live page

After publishing, read the link rel="alternate" tags in the head of each variant's page source. Check that every value is written correctly (language-script-region order) and that the counterpart page contains the same pair. Checking this one page at a time in developer tools is slower than a site-wide crawl, and a crawler gives more reliable results.

If you use a sitemap, make sure the same values appear exactly in the xhtml:link elements there. When page source and sitemap disagree, it becomes unclear which values are processed, and debugging gets harder.

When is a script code not needed?

If your site has a single Chinese version and you do not produce separate content for Taiwan and Hong Kong, a script code such as zh-Hant may be enough, and adding a region code can create unnecessary complexity. If you publish Serbian content in only one alphabet, the choice between sr-Latn and sr-Cyrl matters less while the other alphabet is not in use. The decision should follow the versions that actually exist; the reasoning "we may need it later" is often a source of errors.

Conclusion and next step

When used correctly, script codes make the distinction between language and writing system explicit. They do not replace the rules for region codes and return tags. Decide first which writing system you are targeting, then which country, and only then write the values. For the next step, read our article on hreflang in the CDN and caching layer, which covers the same topic from the infrastructure side.

FAQ

Frequently Asked Questions

  • What do zh-Hans and zh-Hant mean?

    zh-Hans is the BCP 47 script subtag for Simplified Chinese, and zh-Hant is the one for Traditional Chinese. Hans and Hant are script codes from the ISO 15924 standard. They do not carry country information on their own, so add a region code if you need a country target.

  • Is it mandatory to use script codes in hreflang?

    No, most sites do not need them. A script code is useful when you must separate two writing systems of the same language. A language and region combination is enough in many cases, and Google's documentation uses this format in its examples.

  • What is the difference between zh-Hant and zh-TW?

    zh-Hant names the Traditional Chinese writing system, while zh-TW names the Taiwan region. Use zh-TW for a page aimed at Taiwan and zh-Hant when you only want to specify the writing system. Which one works better on your site should be measured, not assumed.

  • When are sr-Latn and sr-Cyrl used?

    Serbian can be written in Latin or Cyrillic. Use sr-Latn when the page content is in Latin script and sr-Cyrl when it is in Cyrillic. What matters most is that the tag matches the real writing system of the page.

  • How do you combine a script code with a region code?

    Keep the order language, script, region, for example zh-Hant-TW. Using both is valid, but it is not required on every page. Add the region code only when there is a real country target.

  • Do underscores or capital letters cause errors?

    Underscores do: zh_Hans is not a valid BCP 47 tag, so use a hyphen. Capitalization is not significant under the standard, but for consistency write the script part as Hans, Hant, Latn or Cyrl.

  • How does Google handle script codes?

    Google's hreflang documentation describes the language and region format and does not make an explicit promise about script subtags. Before relying on script codes, monitor the results in Search Console and treat the outcome as an open question.

  • What are the most common script code mistakes?

    The most frequent errors are using underscores, writing language names instead of codes, mismatching the script with the content, and leaving out return tags. Make sure every variant points back to the others, because a missing reciprocal link breaks the hreflang pair.

Related Articles

No comments yet

Leave a Comment