HTML <html lang> Checker
Extract lang, xml:lang and dir from HTML/XHTML, then check BCP-47 format and common errors.
Results
Why <html lang> matters
- Accessibility: Screen readers pick correct pronunciation rules and voices from the page language.
- Typography & hyphenation: Browsers select fonts and hyphenation dictionaries better with the right language.
- Spellcheck & input: Editors and assistive tools switch dictionaries appropriately.
- Search engines: Clarifies the page’s primary language (separate from geotargeting).
FAQs
Do I have to use lowercase for the lang tag?
Language tags are case-insensitive, but conventional casing helps readability: language lowercase (en), Script Title (Hans), region UPPER (GB). Example: zh-Hans-CN.
Is xml:lang required in HTML5?
No. Use the lang attribute on the html element. If you also use xml:lang (e.g., XHTML), keep it identical to lang.
Should I use meta http-equiv="content-language"?
No. It is deprecated/ignored in modern HTML. Declare the primary language with <html lang> instead.
What if parts of the page are in a different language?
Keep <html lang> for the primary page language and add lang (or xml:lang) to specific elements that are in another language.
Should I set dir="rtl"?
If the primary content is right-to-left (Arabic, Hebrew, Persian), set dir="rtl" on <html> to ensure correct bidi layout.
Does <html lang> affect SEO?
It mainly aids accessibility and language processing. For language targeting in search, use hreflang annotations; <html lang> is still good practice.