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
| Code | Language | Code | Language |
|---|---|---|---|
en | English | fr | French |
es | Spanish | de | German |
it | Italian | pt | Portuguese |
nl | Dutch | sv | Swedish |
pl | Polish | ru | Russian |
tr | Turkish | ar | Arabic |
he | Hebrew | fa | Persian |
hi | Hindi | bn | Bengali |
th | Thai | vi | Vietnamese |
id | Indonesian | ms | Malay |
tl | Tagalog | ja | Japanese |
ko | Korean | zh | Chinese |
Region tags
| Code | Specifies |
|---|---|
en-US | American English |
en-GB | British English |
en-AU | Australian English |
pt-BR | Brazilian Portuguese |
pt-PT | European Portuguese |
zh-CN | Simplified Chinese (mainland) |
zh-TW | Traditional Chinese (Taiwan) |
fr-CA | Canadian 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>
Four letters.
Discussion
Loading…