HTML Language Codes

HTML language codes are used to specify the language of the content in an HTML document. They help improve accessibility, enable proper pronunciation for screen readers, and ensure correct search engine indexing and language-based rendering.

Purpose of Language Codes

The language code in a HTML document is used to:

  • Indicate the natural language of the text.
  • Assist web browsers and assistive technologies in interpreting the content.
  • Help search engines index content based on language.

Structure of Language Codes

  • Language codes follow the IETF BCP 47 standard.
  • Includes primary language subtags (e.g., en for English, fr for French).
  • Optionally includes regional subtags (e.g., en-US for American English, fr-CA for Canadian French).

Syntax of using Language Code in HTML Document

The following is the syntax of using language code in a html document, using the lang attribute of html tag.

index.html

</>
Copy
<html lang="en-US">
  <head>
    <title>Example</title>
  </head>
  <body>
    <p lang="es">Hola, mundo!</p>
    <p lang="fr">Bonjour, le monde!</p>
  </body>
</html>

en-US specifies that the document is in American English.

Commonly Used Language Codes

The following are some of the most commonly used languages across internet, with their respective language code, region, and full code.

LanguageCodeRegionFull Code Example
EnglishenUnited Statesen-US
SpanishesSpaines-ES
FrenchfrCanadafr-CA
Chinese (Simplified)zhChinazh-CN
ArabicarEgyptar-EG

Benefits of using Language Code

  • Enhances SEO by informing search engines about the language of the content.
  • Improves the experience for screen readers and text-to-speech systems.
  • Assists in proper font rendering for languages requiring specific scripts (e.g., Arabic, Hindi).

Resources

For more details on language codes, refer to the following resources:


Table with Complete List of Languages and their respective ISO Codes

LanguageISO Code
Abkhazianab
Afaraa
Afrikaansaf
Akanak
Albaniansq
Amharicam
Arabicar
Aragonesean
Armenianhy
Assameseas
Avaricav
Avestanae
Aymaraay
Azerbaijaniaz
Bambarabm
Bashkirba
Basqueeu
Belarusianbe
Bengali (Bangla)bn
Biharibh
Bislamabi
Bosnianbs
Bretonbr
Bulgarianbg
Burmesemy
Catalanca
Chamorroch
Chechence
Chichewa, Chewa, Nyanjany
Chinesezh
Chinese (Simplified)zh-Hans
Chinese (Traditional)zh-Hant
Chuvashcv
Cornishkw
Corsicanco
Creecr
Croatianhr
Czechcs
Danishda
Divehi, Dhivehi, Maldiviandv
Dutchnl
Dzongkhadz
Englishen
Esperantoeo
Estonianet
Eweee
Faroesefo
Fijianfj
Finnishfi
Frenchfr
Fula, Fulah, Pulaar, Pularff
Galiciangl
Gaelic (Scottish)gd
Gaelic (Manx)gv
Georgianka
Germande
Greekel
Greenlandickl
Guaranign
Gujaratigu
Haitian Creoleht
Hausaha
Hebrewhe
Hererohz
Hindihi
Hiri Motuho
Hungarianhu
Icelandicis
Idoio
Igboig
Indonesianid, in
Interlinguaia
Interlingueie
Inuktitutiu
Inupiakik
Irishga
Italianit
Japaneseja
Javanesejv
Kalaallisut, Greenlandickl
Kannadakn
Kanurikr
Kashmiriks
Kazakhkk
Khmerkm
Kikuyuki
Kinyarwanda (Rwanda)rw
Kirundirn
Kyrgyzky
Komikv
Kongokg
Koreanko
Kurdishku
Kwanyamakj
Laolo
Latinla
Latvian (Lettish)lv
Limburgish ( Limburger)li
Lingalaln
Lithuanianlt
Luga-Katangalu
Luganda, Gandalg
Luxembourgishlb
Manxgv
Macedonianmk
Malagasymg
Malayms
Malayalamml
Maltesemt
Maorimi
Marathimr
Marshallesemh
Moldavianmo
Mongolianmn
Nauruna
Navajonv
Ndongang
Northern Ndebelend
Nepaline
Norwegianno
Norwegian bokmålnb
Norwegian nynorsknn
Nuosuii
Occitanoc
Ojibweoj
Old Church Slavonic, Old Bulgariancu
Oriyaor
Oromo (Afaan Oromo)om
Ossetianos
Pālipi
Pashto, Pushtops
Persian (Farsi)fa
Polishpl
Portuguesept
Punjabi (Eastern)pa
Quechuaqu
Romanshrm
Romanianro
Russianru
Samise
Samoansm
Sangosg
Sanskritsa
Serbiansr
Serbo-Croatiansh
Sesothost
Setswanatn
Shonasn
Sichuan Yiii
Sindhisd
Sinhalesesi
Siswatiss
Slovaksk
Sloveniansl
Somaliso
Southern Ndebelenr
Spanishes
Sundanesesu
Swahili (Kiswahili)sw
Swatiss
Swedishsv
Tagalogtl
Tahitianty
Tajiktg
Tamilta
Tatartt
Telugute
Thaith
Tibetanbo
Tigrinyati
Tongato
Tsongats
Turkishtr
Turkmentk
Twitw
Uyghurug
Ukrainianuk
Urduur
Uzbekuz
Vendave
Vietnamesevi
Volapükvo
Wallonwa
Welshcy
Wolofwo
Western Frisianfy
Xhosaxh
Yiddishyi, ji
Yorubayo
Zhuang, Chuangza
Zuluzu
HTML Language Codes Reference Table