</>
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.

Find this error in your own code. Paste your HTML or enter a URL, free and instant.Open the validator
9.5%
of sites tested

How common is this error?

We ran this validator over the home page of the Tranco top 5,000 websites in August 2026. 251 of the 2,656 sites we could reach hit it. That makes it the 13th most common HTML problem we found, across 253 occurrences. See the full study.

Most frequent wording: The <html> element has no "lang" attribute. It is valid HTML, but it leaves the page language undeclared, which fails WCAG 3.1.1.

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.

Common Causes

  • Starting from a bare <html> tag without setting the language.
  • Using a boilerplate or generator that omits lang.
  • Serving multilingual content from one template that never sets the per-page language.

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".

Frequently Asked Questions

Where exactly does the lang attribute go?
On the root <html> element: <html lang="en">. It sets the default language for the whole document. You can override it on individual elements for inline foreign-language passages.
What value should I use for lang?
A BCP 47 code: en for English, fr for French, es for Spanish, and so on. Add a region subtag when it matters, like en-US or pt-BR.
Does the lang attribute affect SEO?
Indirectly. It helps search engines serve your page to the right language audience and works alongside hreflang. Its bigger role is correct screen-reader pronunciation and browser translation.

Check Your HTML Now

Our validator detects this error automatically and shows the exact line number.

Open HTML Validator

Related HTML Errors

← View all HTML errors