iwantcoding.com
🔥 Daily 👥 Rooms 🏆 Top Log in Sign up

HTML Lang Codes

The lang attribute on <html> (and any other element) uses BCP-47 language tags. The basic form is language-region.

Common codes

CodeLanguageCodeLanguage
enEnglishfrFrench
esSpanishdeGerman
itItalianptPortuguese
nlDutchsvSwedish
plPolishruRussian
trTurkisharArabic
heHebrewfaPersian
hiHindibnBengali
thThaiviVietnamese
idIndonesianmsMalay
tlTagalogjaJapanese
koKoreanzhChinese

Region tags

CodeSpecifies
en-USAmerican English
en-GBBritish English
en-AUAustralian English
pt-BRBrazilian Portuguese
pt-PTEuropean Portuguese
zh-CNSimplified Chinese (mainland)
zh-TWTraditional Chinese (Taiwan)
fr-CACanadian French
Tip: Use just the language code (en) unless region matters for spelling or pronunciation. Screen readers pick the right voice from this attribute.

Example

Example
<!DOCTYPE html>
<html>
<head>
    <title>HTML Lang Codes</title>
</head>
<body>

<h1>HTML Lang Codes</h1>
<p>This is a demo page for the "HTML Lang Codes" lesson.</p>

</body>
</html>
Try it Yourself »

Exercise

Set the page language to French using the html element's global attribute.

<html ="fr">…</html>

Test yourself

Q1. Set the page language on…
Q2. English (US) tag is…
Q3. Knowing language helps with…

Discussion

Loading…