Missing Lang Attribute
The lang attribute on the <html> element declares the primary language of the page. Screen readers use it to select the correct pronunciation rules. Browser translation features use it to determine the source language. Search engines use it for language-specific results.
Why It Matters
Without the lang attribute, screen readers may use the wrong pronunciation (reading French text with English rules), browser auto-translate features won't work correctly, and search engines may serve your page for the wrong language queries.
Code Examples
<html> <head>...</head> <body>...</body> </html>
<html lang="en"> <head>...</head> <body>...</body> </html>
How to Fix
- 1Add lang="en" (or appropriate code) to your <html> element.
- 2Use standard BCP 47 language codes: en, fr, de, es, zh, ja, etc.
- 3For mixed-language content, use lang on specific elements: <p lang="fr">Bonjour</p>.
- 4For regional variants, use subtags: lang="en-US", lang="pt-BR".
Check Your HTML Now
Our validator detects this error automatically and shows the exact line number.
Open HTML ValidatorHostinger — Fast & Affordable Web Hosting
Deploy clean, validated HTML on reliable hosting.
Related HTML Errors
Missing DOCTYPE Declaration
Learn why <!DOCTYPE html> is required and what happens when it's missing. Fix quirks mode rendering issues.
Missing Viewport Meta Tag
Why the viewport meta tag is essential for responsive design. Fix mobile rendering issues with the correct viewport configuration.
Missing Charset Declaration
Why declaring charset UTF-8 is essential and how missing charset causes encoding issues and garbled text.