HTML Language Codes
How HTML language codes work: the lang attribute, BCP 47 tags with region and script subtags, why they matter, and a full ISO 639-1 code list.
HTML Language Codes
This page explains the language codes you use with the HTML lang attribute (and the related hreflang attribute): what standard they come from, how to combine a language with a region or script, and where to find the code for a given language.
What standard do lang values actually use?
The value of lang is not a bare ISO code — it is a BCP 47 language tag. A BCP 47 tag is built from subtags in a fixed order:
language[-script][-region]- language — a two-letter ISO 639-1 code such as
en,fr,zh. When a language has no 639-1 code, the three-letter ISO 639-2/639-3 code is used instead. - script — an optional four-letter ISO 15924 code such as
Hans(Simplified Han) orHant(Traditional Han). - region — an optional two-letter ISO 3166-1 country code such as
US,BR,GB.
So en is a valid tag, and so are en-US, pt-BR, and zh-Hans. The language subtag is written lowercase, the script is title-case, and the region is uppercase — but tags are matched case-insensitively.
Why declaring the language matters
Setting lang correctly does real work, not just documentation:
- Screen readers pick the right text-to-speech voice and pronunciation rules from
lang. The same letters are read very differently in English versus French, so a wrong or missinglangproduces garbled speech. - Right-to-left languages still need the
dirattribute (dir="rtl") —lang="ar"alone does not flip text direction. - Search engines use the language (and
hreflangon alternate-language pages) to serve the right version of your site to the right audience. - Browsers use it for spell-checking, choosing the correct font/typography, and applying language-specific CSS such as
:lang()and hyphenation.
Declaring the page language
The W3C recommends declaring the primary language of every page with a lang attribute on the root <html> tag:
<!DOCTYPE html>
<html lang="en">
<head>
<title>My page</title>
</head>
<body>
...
</body>
</html>In XHTML you set both lang and xml:lang:
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
...
</html>Adding a region or script subtag
Use a region or script subtag when the variant matters — for spelling, pronunciation, or which written form to show:
<!-- Brazilian Portuguese, distinct from European Portuguese (pt-PT) -->
<html lang="pt-BR">
<!-- Plain Portuguese, no region preference -->
<html lang="pt">
<!-- Chinese written in Simplified characters -->
<html lang="zh-Hans">
<!-- Chinese written in Traditional characters, as used in Taiwan -->
<html lang="zh-Hant-TW">Prefer the shortest tag that conveys the needed distinction: use plain en unless British vs. American spelling actually matters, in which case use en-GB or en-US.
Marking up a phrase in a different language
You are not limited to the whole page. Put lang on any element to mark a span of text in another language, which lets screen readers switch voices mid-sentence:
<p>
She greeted us with a cheerful
<span lang="fr">bonjour</span>
before sitting down.
</p>Here the surrounding page might be lang="en", while bonjour is announced with a French voice.
ISO 639-1 Language Codes
The table below lists the ISO 639-1 two-letter codes — the language subtag you place first in a BCP 47 tag. Languages that have no ISO 639-1 code are marked -; for those, use the ISO 639-2/639-3 three-letter code shown in the note after the dash.
See the list of ISO 639-1 language codes:
| Language | ISO Code |
|---|---|
| Abkhazian | ab |
| Afar | aa |
| Afrikaans | af |
| Albanian | sq |
| Amharic | am |
| Arabic | ar |
| Aragonese | an |
| Armenian | hy |
| Assamese | as |
| Aymara | ay |
| Azerbaijani | az |
| Bashkir | ba |
| Basque | eu |
| Bengali (Bangla) | bn |
| Dzongkha | dz |
| Bihari | bh |
| Bislama | bi |
| Bosnian | bs |
| Breton | br |
| Bulgarian | bg |
| Burmese | my |
| Belarusian | be |
| Cambodian | km |
| Catalan | ca |
| Cherokee | - (639-2/3: chr) |
| Chewa (Chichewa) | ny |
| Chinese | zh |
| Corsican | co |
| Croatian | hr |
| Czech | cs |
| Danish | da |
| Divehi (Dhivehi) | dv |
| Dutch | nl |
| Edo | - (639-2/3: bin) |
| English | en |
| Esperanto | eo |
| Estonian | et |
| Faeroese | fo |
| Farsi | fa |
| Fiji | fj |
| Finnish | fi |
| Flemish (Dutch, Belgium) | nl (region: nl-BE) |
| French | fr |
| Frisian (Western) | fy |
| Fulah (Fulfulde) | ff |
| Galician | gl |
| Gaelic (Scottish) | gd |
| Gaelic (Manx) | gv |
| Georgian | ka |
| German | de |
| Greek | el |
| Greenlandic | kl |
| Guarani | gn |
| Gujarati | gu |
| Haitian Creole | ht |
| Hausa | ha |
| Hawaiian | - (639-2/3: haw) |
| Hebrew | he |
| Hindi | hi |
| Hungarian | hu |
| Ibibio | - (639-2/3: ibb) |
| Icelandic | is |
| Ido | io |
| Igbo | ig |
| Indonesian | id |
| Interlingua | ia |
| Interlingue | ie |
| Inuktitut | iu |
| Inupiak | ik |
| Irish | ga |
| Italian | it |
| Japanese | ja |
| Javanese | jv |
| Kannada | kn |
| Kanuri | kr |
| Kashmiri | ks |
| Kazakh | kk |
| Kinyarwanda (Rwanda) | rw |
| Kirghiz | ky |
| Kirundi (Rundi) | rn |
| Konkani | - (639-2/3: kok) |
| Korean | ko |
| Kurdish | ku |
| Laothian | lo |
| Latin | la |
| Latvian (Lettish) | lv |
| Limburgish (Limburger) | li |
| Lingala | ln |
| Lithuanian | lt |
| Macedonian | mk |
| Malagasy | mg |
| Malay | ms |
| Malayalam | ml |
| Maltese | mt |
| Maori | mi |
| Marathi | mr |
| Mongolian | mn |
| Nauru | na |
| Nepali | ne |
| Norwegian | no |
| Occitan | oc |
| Oriya | or |
| Oromo (Afaan Oromo) | om |
| Papiamento | - (639-2/3: pap) |
| Pashto (Pushto) | ps |
| Polish | pl |
| Portuguese | pt |
| Punjabi | pa |
| Quechua | qu |
| Rhaeto-Romance | rm |
| Romanian | ro |
| Russian | ru |
| Sami (Northern) | se |
| Samoan | sm |
| Sango | sg |
| Sanskrit | sa |
| Serbian | sr |
| Serbo-Croatian | sh (deprecated; use sr, hr, or bs) |
| Sesotho (Southern Sotho) | st |
| Setswana | tn |
| Shona | sn |
| Sichuan Yi | ii |
| Sindhi | sd |
| Sinhalese | si |
| Siswati | ss |
| Slovak | sk |
| Slovenian | sl |
| Somali | so |
| Spanish | es |
| Sundanese | su |
| Swahili (Kiswahili) | sw |
| Swedish | sv |
| Syriac | - (639-2/3: syr) |
| Tagalog | tl |
| Tajik | tg |
| Tamazight (Central Atlas) | - (639-3: tzm) |
| Tamil | ta |
| Tatar | tt |
| Telugu | te |
| Thai | th |
| Tibetan | bo |
| Tigrinya | ti |
| Tonga | to |
| Tsonga | ts |
| Turkish | tr |
| Turkmen | tk |
| Twi | tw |
| Uighur | ug |
| Ukrainian | uk |
| Urdu | ur |
| Uzbek | uz |
| Venda | ve |
| Vietnamese | vi |
| Volapük | vo |
| Walloon | wa |
| Welsh | cy |
| Wolof | wo |
| Xhosa | xh |
| Yiddish | yi |
| Yoruba | yo |
| Zulu | zu |