</>
ValidateHTML

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

❌ Invalid
<html>
  <head>...</head>
  <body>...</body>
</html>
✓ Valid
<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 Validator
Recommended

Hostinger Fast & Affordable Web Hosting

Deploy clean, validated HTML on reliable hosting.

Get 80% Off Hosting →

Related HTML Errors

← View all HTML errors