A little help goes a long way. Find a tool/

Reference FIELD NOTES · 4 MIN READ

Country Codes Explained: Alpha-2, Alpha-3 and Numeric

Why every country has three ISO codes, what each is for, and why the UK’s official code is GB.

Type UK into a government form and it may bounce; type GB and it sails through. Nothing is wrong with either — they are just different things. One is a proud national habit, the other is what the ISO standard actually assigned, and the gap between the two is a good tour of how international country codes really work.

Three codes, one country

ISO 3166-1 gives every entry three interchangeable identifiers. The alpha-2 code is two letters (GB), the alpha-3 code is three (GBR), and the numeric code is three digits (826). All three name the same entity, and any of them can be translated to the others mechanically. The two-letter codes are the ones you meet constantly: they underpin country-code top-level domains (.de, .jp), they appear in locale tags like en-GB and fr-CA, and they are the default in payment forms and address pickers. Three-letter codes show up where documents are read by people — customs paperwork, shipping manifests, ticketing systems — and the digits exist for the cases where letters are the problem.

Why three digits matter

Letters drift with language and alphabet. A numeric code survives every script: China is 156 whether the surrounding record is written in Chinese, Arabic or Cyrillic, and 826 stays 826 in any font or encoding. That script-independence is why UN trade databases, bibliographic standards and several banking formats prefer numeric codes. The numeric system has one more valuable property: a code is never reassigned to a different entity. When Zaire dissolved, its code ZR was withdrawn and the Democratic Republic of the Congo took a new code (CD, 180) — the old records stay unambiguous forever, which is exactly what archives need.

The list is bigger than the map

The standard counts 249 entries, not 193. ISO assigns codes to "countries and dependent territories that are well defined geographically", so Greenland (GL), Hong Kong (HK), Puerto Rico (PR) and even Antarctica (AQ) carry codes. That is not bureaucratic drift: shipping forms, SIM registration, domain delegations and payment cards all treat these territories as separate code spaces. Special cases sit in the list too — the Holy See (VA) and the United States Minor Outlying Islands (UM), a catch-all for specks of reef with no permanent population. Any drop-down built on ISO codes will include territories by design, and filtering them out breaks more than it fixes.

Names move; codes mostly stay

Entries get renamed — Swaziland became Eswatini, Macedonia became North Macedonia, Turkey became Türkiye, the Czech Republic became Czechia — but the codes themselves rarely change, because changing them would break every dataset that mentions the country. Names follow a formal UN-style convention, which is why official lists read oddly: "Korea, Republic of", "Bolivia, Plurinational State of", "Taiwan, Province of China". Informal names still resolve — South Korea, Holland, Burma, Ivory Coast — through alias tables like the one built into our Country Code Lookup. The alias layer is doing real work: ISO assigns UK only as an "exceptionally reserved" code, yet the letters remain what millions of people type first.

Using the codes in software

Practical rules follow from the design. Store alpha-2 as the canonical form: it is the shortest, it matches domain conventions, and most APIs and locale libraries expect it. Accept either case on input — gb, DE and dEu are the same code — and tolerate the famous aliases (UK for GB, UAE for AE) while flagging them. Validate against the full 249-entry list, not just UN members, or you will reject Curaçao (CW) and Gibraltar (GI) as typos. When records must cross script boundaries — multilingual archives, financial messaging, treaty documents — store the numeric code instead, because digits carry no alphabet with them.

Try it yourself

Look up a handful of codes in the Country Code Lookup: try GB and then UK to see the alias note, 076 to watch zero-padding work, and "united" to see how exact matches sort to the top. To meet another code system that outlives the language around it, read how Unicode assigns code points to every character, or see how time zones slice the same territory along completely different lines.

Frequently asked questions

What is the difference between alpha-2 and alpha-3 country codes?
Alpha-2 is the two-letter form (GB, DE, JP) used in internet domains, locale tags and everyday forms; alpha-3 is the three-letter form (GBR, DEU, JPN) used where three letters read better or where alpha-2 codes collide with other standards, such as customs and shipping documents. Both identify the same entry, and the numeric code is a third, script-independent form.
Why is the UK’s country code GB and not UK?
ISO assigned GB in 1974, following the convention of the time for Great Britain as the sovereign state’s short name. UK was left "exceptionally reserved" rather than assigned, and it lives on in the .uk domain space. Software that validates user input should accept GB as correct and usually tolerate UK as an alias, which is exactly what our lookup tool does.
Do the 249 ISO codes correspond to UN member states?
No. ISO 3166-1 assigns codes to "countries and dependent territories that are well defined geographically", so the list includes 193 UN members plus territories like Greenland, Hong Kong, Puerto Rico and Antarctica. That is why the list has 249 entries — and why a "country" drop-down built on ISO codes has always included territories.
Can country codes change or be withdrawn?
Yes, though rarely. Codes are withdrawn when an entity disappears (Zaire’s ZR became the Democratic Republic of the Congo’s CD) and names change while codes stay (Swaziland became Eswatini but keeps SZ; Turkey became Türkiye but keeps TR). Withdrawn codes are never reused for a different entity, which is why old data stays unambiguous.
Which code should I store in my database?
Most systems store alpha-2: it is the shortest, it matches domain conventions, and it is what most APIs and locale libraries expect. Use numeric codes when records must survive script or encoding changes, and alpha-3 when documents are read by humans who benefit from the extra context. Store one canonical form and translate on display.