HTML Language Code

Beginner
⏱️ 8 min read
📚 Updated: Jul 2026
🎯 3 Try It + 191 codes
lang

Introduction

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.

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:

LanguageISO Code
Englishen
Frenchfr
Spanishes
Germande
Hindihi
Japaneseja
Chinese (Simplified)zh-Hans
Arabicar
💡
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.

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.

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

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.

⚡ Quick Reference

TaskMarkup
English page<html lang="en">
US English<html lang="en-US">
French paragraph<p lang="fr">...</p>
Read in JSdocument.documentElement.lang

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>
Try It Yourself

How It Works

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>
Try It Yourself

How It Works

Nested lang overrides the document default only for that subtree—essential for accessibility on multilingual sites.

Example 3 — Full page (BCP 47 region tag)

Use a language plus region code for locale-specific content such as US English:

html
<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="UTF-8">
    <title>HTML Document</title>
  </head>
  <body>
    <!-- Content of the HTML document -->
  </body>
</html>
Try It Yourself

How It Works

en-US follows BCP 47: lowercase language (en) + uppercase region (US). Pair with country codes when you need both.

🚀 Why Language Codes Matter

  • Screen readers — correct pronunciation and voice selection.
  • SEO — helps search engines serve the right locale.
  • Hyphenation — browsers break lines using language rules.
  • Spell check — browser dictionaries match the declared language.
  • Translation tools — machine translation knows the source language.

Best Practices

  • Always set lang on html — every page should declare its primary language.
  • Use valid BCP 47 tags — lowercase language, uppercase region: en-GB.
  • 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.

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.

Next: learn how servers communicate status with HTTP Status Codes, or dive deeper into the HTML lang attribute.

❓ Frequently Asked Questions

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.

Try lang in the editor

Change lang="en" to another code and see how the document language updates.

Open Try It editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful