Language codes tell browsers, search engines, and assistive technologies which human language your content uses. In HTML you declare them with the lang attribute—most often on the <html> element using ISO 639-1 two-letter codes like en or fr.
What You’ll Learn
01
ISO 639-1
Two letters.
02
lang attr
On html.
03
BCP 47
en-US tags.
04
Mixed
Nested lang.
05
a11y
Screen readers.
06
Full list
191 codes.
Fundamentals
What is HTML Language Code?
HTML language codes are used to specify the language of the content within an HTML document.
These codes are defined by the ISO 639-1 standard, which assigns two-letter codes to represent different languages.
Here are some examples of commonly used HTML language codes:
Language
ISO Code
English
en
French
fr
Spanish
es
German
de
Hindi
hi
Japanese
ja
Chinese (Simplified)
zh-Hans
Arabic
ar
💡
Beginner Tip
Language codes identify languages (en). Country codes identify nations (US). Combine them for regional variants: lang="en-US". See Country Code for ISO country lists.
Reference
ISO 639-1 Language Code Table
Complete reference table (191 entries). Some rows list legacy or alternate codes separated by commas—prefer the first code for new projects.
Language
ISO Code
Abkhazian
ab
Afar
aa
Afrikaans
af
Akan
ak
Albanian
sq
Amharic
am
Arabic
ar
Aragonese
an
Armenian
hy
Assamese
as
Avaric
av
Avestan
ae
Aymara
ay
Azerbaijani
az
Bambara
bm
Bashkir
ba
Basque
eu
Belarusian
be
Bengali (Bangla)
bn
Bihari
bh
Bislama
bi
Bosnian
bs
Breton
br
Bulgarian
bg
Burmese
my
Catalan
ca
Chamorro
ch
Chechen
ce
Chichewa, Chewa, Nyanja
ny
Chinese
zh
Chinese (Simplified)
zh-Hans
Chinese (Traditional)
zh-Hant
Chuvash
cv
Cornish
kw
Corsican
co
Cree
cr
Croatian
hr
Czech
cs
Danish
da
Divehi, Dhivehi, Maldivian
dv
Dutch
nl
Dzongkha
dz
English
en
Esperanto
eo
Estonian
et
Ewe
ee
Faroese
fo
Fijian
fj
Finnish
fi
French
fr
Fula, Fulah, Pulaar, Pular
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
Hebrew
he
Herero
hz
Hindi
hi
Hiri Motu
ho
Hungarian
hu
Icelandic
is
Ido
io
Igbo
ig
Indonesian
id, in
Interlingua
ia
Interlingue
ie
Inuktitut
iu
Inupiak
ik
Irish
ga
Italian
it
Japanese
ja
Javanese
jv
Kalaallisut, Greenlandic
kl
Kannada
kn
Kanuri
kr
Kashmiri
ks
Kazakh
kk
Khmer
km
Kikuyu
ki
Kinyarwanda (Rwanda)
rw
Kirundi
rn
Kyrgyz
ky
Komi
kv
Kongo
kg
Korean
ko
Kurdish
ku
Kwanyama
kj
Lao
lo
Latin
la
Latvian (Lettish)
lv
Limburgish ( Limburger)
li
Lingala
ln
Lithuanian
lt
Luga-Katanga
lu
Luganda, Ganda
lg
Luxembourgish
lb
Manx
gv
Macedonian
mk
Malagasy
mg
Malay
ms
Malayalam
ml
Maltese
mt
Maori
mi
Marathi
mr
Marshallese
mh
Moldavian
mo
Mongolian
mn
Nauru
na
Navajo
nv
Ndonga
ng
Northern Ndebele
nd
Nepali
ne
Norwegian
no
Norwegian bokmål
nb
Norwegian nynorsk
nn
Nuosu
ii
Occitan
oc
Ojibwe
oj
Old Church Slavonic, Old Bulgarian
cu
Oriya
or
Oromo (Afaan Oromo)
om
Ossetian
os
Pāli
pi
Pashto, Pushto
ps
Persian (Farsi)
fa
Polish
pl
Portuguese
pt
Punjabi (Eastern)
pa
Quechua
qu
Romansh
rm
Romanian
ro
Russian
ru
Sami
se
Samoan
sm
Sango
sg
Sanskrit
sa
Serbian
sr
Serbo-Croatian
sh
Sesotho
st
Setswana
tn
Shona
sn
Sichuan Yi
ii
Sindhi
sd
Sinhalese
si
Siswati
ss
Slovak
sk
Slovenian
sl
Somali
so
Southern Ndebele
nr
Spanish
es
Sundanese
su
Swahili (Kiswahili)
sw
Swati
ss
Swedish
sv
Tagalog
tl
Tahitian
ty
Tajik
tg
Tamil
ta
Tatar
tt
Telugu
te
Thai
th
Tibetan
bo
Tigrinya
ti
Tonga
to
Tsonga
ts
Turkish
tr
Turkmen
tk
Twi
tw
Uyghur
ug
Ukrainian
uk
Urdu
ur
Uzbek
uz
Venda
ve
Vietnamese
vi
Volapük
vo
Wallon
wa
Welsh
cy
Wolof
wo
Western Frisian
fy
Xhosa
xh
Yiddish
yi, ji
Yoruba
yo
Zhuang, Chuang
za
Zulu
zu
Syntax
Using the lang Attribute
To specify the language of an HTML document, you can use the lang attribute on the <html> tag. Here’s an example:
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML Document</title>
</head>
<body>
<!-- Content of the HTML document -->
</body>
</html>
In this example, the lang attribute is set to en, indicating that the content of the HTML document is in English.
This information can be used by browsers, search engines, and assistive technologies to provide language-specific features and optimizations.
By setting the appropriate language code for your HTML documents, you can improve accessibility, SEO (Search Engine Optimization), and user experience for users who speak different languages.
Cheat Sheet
⚡ Quick Reference
Task
Markup
English page
<html lang="en">
US English
<html lang="en-US">
French paragraph
<p lang="fr">...</p>
Read in JS
document.documentElement.lang
Hands-On
Examples Gallery
Three short examples from a single lang attribute to a full page with mixed languages. Try It Yourself opens plain HTML demos with no CSS.
Example 1 — Document lang
Set lang="en" on <html> so the whole page is declared as English:
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>English page</title>
</head>
<body>
<h1>Hello</h1>
<p>This document is in English.</p>
</body>
</html>
Browsers and screen readers read document.documentElement.lang from this attribute.
Example 2 — Mixed languages
Override lang on individual elements when one page contains multiple languages:
html
<html lang="en">
<body>
<p>This paragraph is English (document default).</p>
<p lang="fr">Ce paragraphe est en français.</p>
<p lang="es">Este párrafo está en español.</p>
<p lang="hi">यह अनुच्छेद हिंदी में है।</p>
</body>
</html>
Mark foreign phrases — wrap quotes or names in an element with the correct lang.
Pair with hreflang — for multilingual sites, link alternate language versions.
Do not confuse with country — see Country Code for nation codes.
Wrap-Up
Conclusion
HTML language codes power accessibility, SEO, and localization through the simple lang attribute. Start with ISO 639-1 two-letter codes, use the full table above as your reference, and declare language on every page you publish.
It is a short tag that identifies the human language of content, usually on the lang attribute. Common codes follow ISO 639-1 (two letters) or BCP 47 (language plus region, e.g. en-US).
On the html element for the whole page: html lang="en". For mixed-language pages, add lang on specific elements such as p or span.
en is generic English. en-US is English as used in the United States (BCP 47). Use the more specific tag when region affects spelling, currency, or screen reader pronunciation.
Yes. Search engines use lang to match pages to user language preferences and to avoid treating translated duplicates as thin content when hreflang is also set.
No. Language codes (en, fr) identify languages. Country codes (US, FR) identify nations. Combine them in BCP 47: lang="en-GB" is British English.
ISO 639-1 prefers id for Indonesian today. in was deprecated but may appear in legacy lists. Always check current ISO guidance for new projects.
Did you know?
The xml:lang attribute serves a similar purpose in XHTML documents. In modern HTML5, lang alone is sufficient and is the attribute you should use.