No Login Data Private Local Save

HTML lang Validator - Online Check Language Tag

6
0
0
0

HTML Lang Validator

Validate & parse BCP 47 language tags for your HTML lang attribute

Try: en-US zh-CN zh-Hant-CN fr-FR pt-BR ar-SA
Common Language Tags
Tag Language Region
enEnglish-
en-USEnglishUnited States
en-GBEnglishUnited Kingdom
zh-CNChineseChina
zh-TWChineseTaiwan
zh-HansChinese (Simplified)-
zh-HantChinese (Traditional)-
fr-FRFrenchFrance
de-DEGermanGermany
ja-JPJapaneseJapan
ko-KRKoreanSouth Korea
es-ESSpanishSpain
es-MXSpanishMexico
pt-BRPortugueseBrazil
pt-PTPortuguesePortugal
it-ITItalianItaly
ru-RURussianRussia
ar-SAArabicSaudi Arabia
hi-INHindiIndia
nl-NLDutchNetherlands
sv-SESwedishSweden
pl-PLPolishPoland
tr-TRTurkishTurkey
vi-VNVietnameseVietnam
th-THThaiThailand
id-IDIndonesianIndonesia
ms-MYMalayMalaysia

Click any tag to validate it instantly

Frequently Asked Questions
What is an HTML lang attribute and why is it important?
The HTML lang attribute specifies the primary language of a webpage or a specific element. It helps search engines understand content language, improves accessibility for screen readers, and ensures proper text rendering. Using a valid BCP 47 language tag like en-US helps browsers apply correct hyphenation, font selection, and spelling dictionaries.
What is a BCP 47 language tag?
BCP 47 (Best Current Practice 47) defines the standard format for language tags used in HTML, XML, and other web technologies. A tag consists of subtags separated by hyphens: a primary language subtag (2-3 letters, e.g., en, zh), optionally followed by a script subtag (4 letters, e.g., Hant), a region subtag (2 letters or 3 digits, e.g., US), and variant subtags. Examples: en-US, zh-Hant-CN.
How do I check if my language tag is valid?
Use this HTML Lang Validator tool to instantly check your language tag. Simply type or paste your tag into the input field, and the tool will validate it against BCP 47 rules, parse its components, and show detailed information about the language, script, and region. It also detects common mistakes like using underscores instead of hyphens.
Does the lang attribute affect SEO?
Yes. Search engines like Google use the lang attribute as a signal to determine the language of your content. Proper language tagging helps with geo-targeting, improves search result accuracy for multilingual queries, and can enhance your site's visibility in language-specific search results. It also supports proper hreflang implementation for multilingual websites.
What's the difference between lang and hreflang?
The lang attribute declares the language of the current page's content. The hreflang attribute (used in <link> tags or sitemaps) tells search engines about alternate language versions of a page. While both use BCP 47 tags, lang is for the current document, and hreflang points to other language versions. For example: <html lang="en-US"> vs <link rel="alternate" hreflang="es-MX" href="...">.
What are the most common HTML language codes?
Common language tags include en-US (English - US), en-GB (English - UK), zh-CN (Chinese - China), fr-FR (French - France), de-DE (German - Germany), ja-JP (Japanese), es-ES (Spanish - Spain), pt-BR (Portuguese - Brazil), ar-SA (Arabic), and ru-RU (Russian). You can find a comprehensive list in the reference table on this page.
What happens if I use an invalid language tag?
Using an invalid language tag won't break your page, but browsers and assistive technologies may not recognize the language correctly. This can lead to suboptimal text-to-speech pronunciation, incorrect spell checking, and missed SEO opportunities. Always use valid BCP 47 tags to ensure proper interpretation by all user agents.
Can I use underscores instead of hyphens in language tags?
No. BCP 47 language tags must use hyphens (-) as separators, not underscores. For instance, en_US is invalid; the correct form is en-US. Using underscores is a common mistake inherited from programming language locale conventions (like en_US in Python or C). Always use hyphens for HTML lang attributes.
How do I set the language for multilingual websites?
Set the lang attribute on the <html> element for the primary language. For mixed-language content, add lang attributes to specific elements. Example: <html lang="en"> with <span lang="fr">Bonjour</span>. For separate language versions, use different URLs with proper hreflang annotations to help search engines serve the right version to users.
What is the format of a valid language tag?
A valid BCP 47 language tag follows this structure: language (2-3 letters, required) + optional script (4 letters) + optional region (2 letters or 3 digits) + optional variants + optional extensions. All parts are separated by hyphens. Examples: en (minimal), en-US (language + region), zh-Hant-CN (language + script + region). Tags are case-insensitive but conventionally use lowercase for language and uppercase for region.