HTML Country Codes

HTML country codes are used alongside language codes to specify the regional variant of a language. They help enhance localization and ensure that the content is suitable for a specific audience or region.

Purpose of Country Codes in HTML

Country Codes in a HTML document are used to:

  • Specify the regional variation of a language (e.g., American English vs. British English).
  • Ensure the content is culturally appropriate for a specific audience.
  • Assist in accurate rendering of date formats, currency, and other region-specific elements.

Structure of Country Codes

Country codes are appended to the language code using a hyphen (-). They follow the ISO 3166-1 alpha-2 standard, which uses two-letter abbreviations for countries.

Syntax

</>
Copy
<html lang="en-US"> <!-- English (United States) -->
<p lang="en-GB">Colour</p> <!-- British English -->
<p lang="es-MX">Hola</p> <!-- Spanish (Mexico) -->

Commonly Used Country Codes

The following tables contains the commonly used country codes.

CountryCodeLanguage Example
United StatesUSen-US (American English)
United KingdomGBen-GB (British English)
CanadaCAfr-CA (Canadian French)
ChinaCNzh-CN (Simplified Chinese)
MexicoMXes-MX (Mexican Spanish)
GermanyDEde-DE (German)
JapanJPja-JP (Japanese)

Benefits of Country Code in HTML Document

  • Enables proper cultural localization of content.
  • Improves SEO by targeting specific countries or regions.
  • Helps screen readers, assistive technologies, and browsers interpret content correctly for a particular audience.

Full Code Example

</>
Copy
<!DOCTYPE html>
<html lang="en-US">
  <head>
    <title>HTML Country Codes</title>
  </head>
  <body>
    <h1>Regional Language Examples</h1>
    <p lang="en-US">Color</p> <!-- American English -->
    <p lang="en-GB">Colour</p> <!-- British English -->
    <p lang="es-MX">¡Hola!</p> <!-- Mexican Spanish -->
    <p lang="fr-CA">Bonjour!</p> <!-- Canadian French -->
  </body>
</html>

HTML Country Codes Reference Table

CountryISO Code
AFGHANISTANAF
ALBANIAAL
ALGERIADZ
AMERICAN SAMOAAS
ANDORRAAD
ANGOLAAO
ANTARCTICAAQ
ANTIGUA AND BARBUDAAG
ARGENTINAAR
ARMENIAAM
ARUBAAW
AUSTRALIAAU
AUSTRIAAT
AZERBAIJANAZ
BAHAMASBS
BAHRAINBH
BANGLADESHBD
BARBADOSBB
BELARUSBY
BELGIUMBE
BELIZEBZ
BENINBJ
BERMUDABM
BHUTANBT
BOLIVIABO
BOSNIA AND HERZEGOVINABA
BOTSWANABW
BOUVET ISLANDBV
BRAZILBR
BRITISH INDIAN OCEAN TERRITORYIO
BRUNEI DARUSSALAMBN
BULGARIABG
BURKINA FASOBF
BURUNDIBI
CAMBODIAKH
CAMEROONCM
CANADACA
CAPE VERDECV
CAYMAN ISLANDSKY
CENTRAL AFRICAN REPUBLICCF
CHADTD
CHILECL
CHINACN
CHRISTMAS ISLANDCX
COCOS (KEELING) ISLANDSCC
COLOMBIACO
COMOROSKM
CONGOCG
CONGO, THE DEMOCRATIC REPUBLIC OF THECD
COOK ISLANDSCK
COSTA RICACR
CÔTE D’IVOIRECI
CROATIAHR
CUBACU
CYPRUSCY
CZECH REPUBLICCZ
DENMARKDK
DJIBOUTIDJ
DOMINICADM
DOMINICAN REPUBLICDO
ECUADOREC
EGYPTEG
EL SALVADORSV
EQUATORIAL GUINEAGQ
ERITREAER
ESTONIAEE
ETHIOPIAET
FALKLAND ISLANDS (MALVINAS)FK
FAROE ISLANDSFO
FIJIFJ
FINLANDFI
FRANCEFR
FRENCH GUIANAGF
FRENCH POLYNESIAPF
FRENCH SOUTHERN TERRITORIESTF
GABONGA
GAMBIAGM
GEORGIAGE
GERMANYDE
GHANAGH
GIBRALTARGI
GREECEGR
GREENLANDGL
GRENADAGD
GUADELOUPEGP
GUAMGU
GUATEMALAGT
GUINEAGN
GUINEA-BISSAUGW
GUYANAGY
HAITIHT
HEARD ISLAND AND MCDONALD ISLANDSHM
HONDURASHN
HONG KONGHK
HUNGARYHU
ICELANDIS
INDIAIN
INDONESIAID
IRAN, ISLAMIC REPUBLIC OFIR
IRAQIQ
IRELANDIE
ISRAELIL
ITALYIT
JAMAICAJM
JAPANJP
JORDANJO
KAZAKHSTANKZ
KENYAKE
KIRIBATIKI
KOREA, DEMOCRATIC PEOPLE’S REPUBLIC OFKP
KOREA, REPUBLIC OFKR
KUWAITKW
KYRGYZSTANKG
LAO PEOPLE’S DEMOCRATIC REPUBLIC(LAOS)LA
LATVIALV
LEBANONLB
LESOTHOLS
LIBERIALR
LIBYA, STATE OFLY
LIECHTENSTEINLI
LITHUANIALT
LUXEMBOURGLU
MACAOMO
MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OFMK
MADAGASCARMG
MALAWIMW
MALAYSIAMY
MALDIVESMV
MALIML
MALTAMT
MARSHALL ISLANDSMH
MARTINIQUEMQ
MAURITANIAMR
MAURITIUSMU
MAYOTTEYT
MEXICOMX
MICRONESIA, FEDERATED STATES OFFM
MOLDOVA, REPUBLIC OFMD
MONACOMC
MONGOLIAMN
MONTENEGROME
MONTSERRATMS
MOROCCOMA
MOZAMBIQUEMZ
MYANMARMM
NAMIBIANA
NAURUNR
NEPAL, FEDERAL DEMOCRATIC REPUBLIC OFNP
NETHERLANDSNL
NETHERLANDS ANTILLESAN
NEW CALEDONIANC
NEW ZEALANDNZ
NICARAGUANI
NIGERNE
NIGERIANG
NIUENU
NORFOLK ISLANDNF
NORTHERN MARIANA ISLANDSMP
NORWAYNO
OMANOM
PAKISTANPK
PALAUPW
PALESTINE, STATE OFPS
PANAMAPA
PAPUA NEW GUINEAPG
PARAGUAYPY
PERUPE
PHILIPPINESPH
PITCAIRNPN
POLANDPL
PORTUGALPT
PUERTO RICOPR
QATARQA
RÉUNIONRE
ROMANIARO
RUSSIAN FEDERATIONRU
RWANDARW
SAINT HELENASH
SAINT KITTS AND NEVISKN
SAINT LUCIALC
SAINT PIERRE AND MIQUELONPM
SAINT VINCENT AND THE GRENADINESVC
SAMOAWS
SAN MARINOSM
SAO TOME AND PRINCIPEST
SAUDI ARABIASA
SENEGALSN
SERBIARS
SEYCHELLESSC
SIERRA LEONESL
SINGAPORESG
SLOVAKIASK
SLOVENIASI
SOLOMON ISLANDSSB
SOMALIASO
SOUTH AFRICAZA
SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDSGS
SOUTH SUDANSS
SPAINES
SRI LANKALK
SUDANSD
SURINAMESR
SVALBARD AND JAN MAYENSJ
SWAZILANDSZ
SWEDENSE
SWITZERLANDCH
SYRIAN ARAB REPUBLICSY
TAIWANTW
TAJIKISTANTJ
TANZANIA, UNITED REPUBLIC OFTZ
THAILANDTH
TIMOR-LESTETL
TOGOTG
TOKELAUTK
TONGATO
TRINIDAD AND TOBAGOTT
TUNISIATN
TURKEYTR
TURKMENISTANTM
TURKS AND CAICOS ISLANDSTC
TUVALUTV
UGANDAUG
UKRAINEUA
UNITED ARAB EMIRATESAE
UNITED KINGDOMGB
UNITED STATESUS
UNITED STATES MINOR OUTLYING ISLANDSUM
URUGUAYUY
UZBEKISTANUZ
VANUATUVU
VENEZUELAVE
VIET NAMVN
VIRGIN ISLANDS, BRITISHVG
VIRGIN ISLANDS, U.S.VI
WALLIS AND FUTUNAWF
WESTERN SAHARAEH
YEMENYE
ZAMBIAZM
ZIMBABWEZW