Developer and Text Tools

Language Codes and Locale Tags: en-GB, pt-BR and zh-Hant Explained

How ISO 639 language codes, script and region codes combine into BCP 47 locale tags, which code to choose, and where tags matter in HTML, SEO and apps.

Saizul Amin
Saizul Amin30 Oct 2026 · 3 min read
Language Codes and Locale Tags: en-GB, pt-BR and zh-Hant Explained

Language Codes and Locale Tags: en-GB, pt-BR and zh-Hant Explained

Every multilingual website, app and document needs to say which language it is in, and the answer is a code. But which one? Is German de, deu or ger? Is it en-UK or en-GB? When do you need zh-Hant rather than zh-TW? The free Language and Locale Code Lookup answers these questions, builds correct locale tags and shows how software formats dates and numbers for each one.

ISO 639: the language codes

The ISO 639 standard has several parts:

  • ISO 639-1 gives two-letter codes for about 180 major languages: en, de, bn, ja.
  • ISO 639-2 gives three-letter codes for around 500 languages. For about twenty of them there are two versions: a terminology code based on the language's own name (deu for Deutsch) and an older bibliographic code based on the English name (ger). Libraries still use the bibliographic codes.
  • ISO 639-3 extends the list to nearly 8,000 languages, including many without two-letter codes, such as Cantonese (yue), Filipino (fil) and Hawaiian (haw).

The rule for software is simple: use the two-letter code when one exists, otherwise the three-letter code.

BCP 47: building a locale tag

A locale tag combines a language with optional subtags:

  • Script, four letters in title case: Latn, Cyrl, Arab, Hans, Hant. Needed when a language uses more than one writing system, as Serbian does with Latin and Cyrillic, or Chinese with simplified and traditional characters.
  • Region, two letters from ISO 3166 or three digits from the UN: GB, US, BR, or 419 for Latin America.

So en-GB is British English, pt-BR Brazilian Portuguese, zh-Hant-TW traditional Chinese as used in Taiwan and sr-Latn Serbian in Latin script. The region code for the United Kingdom is GB, so en-UK is wrong, a very common mistake.

Only add what matters

A shorter tag is usually better. If your content is the same for all English speakers, use en. Add a region when spelling, vocabulary, currency or legal content differ, as between en-GB and en-US or pt-PT and pt-BR. Add a script only when the language really varies by script.

The lookup shows each tag's maximised form, with likely script and region added, and its minimised form, the shortest tag that means the same thing. pt-BR maximises to pt-Latn-BR and minimises to pt.

Where locale tags are used

  • HTML: the lang attribute on the html element tells screen readers how to pronounce text and lets browsers hyphenate and spell-check correctly.
  • SEO: hreflang annotations tell search engines which page to show to which language and region.
  • HTTP: browsers send Accept-Language, and servers use it to choose content.
  • Apps and code: JavaScript's Intl APIs, Java's Locale and similar libraries format dates, numbers and currencies by tag.

What locale formatting looks like

The preview uses the Unicode CLDR data in your browser. For pt-BR, the number 1234567.891 becomes 1.234.567,891 and a date becomes "quinta-feira, 29 de outubro de 2026". It also lists plural categories: English has one and other, Portuguese adds many, and Arabic uses six. That is why translations need more than one plural form.

Step by step

  1. Search for a language by name or any code.
  2. Note the two- and three-letter codes and the writing direction.
  3. Enter a language, script and region to build a tag.
  4. Check the canonical, maximised and minimised forms.
  5. Preview dates, numbers and currency, then use the tag in HTML or your app.

Privacy

All lookups and previews run in your browser.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages