# This document appears to be written in English but the “html” start tag has an empty “lang” attribute. Consider using “lang="en"” (or variant) instead.

> Canonical HTML version: https://rocketvalidator.com/html-validation/this-document-appears-to-be-written-in-english-but-the-html-start-tag-has-an-empty-lang-attribute-consider-using-lang-en-or-variant-instead
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `lang` attribute on the `<html>` element declares the primary language of the document's content. When this attribute is left empty (`lang=""`), it effectively tells browsers and assistive technologies that the language is unknown or intentionally unspecified — which is almost never what you want.

This matters for several important reasons:

- **Accessibility:** Screen readers rely on the `lang` attribute to select the correct pronunciation engine. An empty value can cause a screen reader to fall back to a default language, potentially reading English text with incorrect pronunciation rules.
- **Search engines:** Search engines use the `lang` attribute to understand what language your content is in, which helps serve your pages to the right audience.
- **Browser features:** Browsers use the language declaration for hyphenation, spell-checking, font selection, and other language-sensitive rendering decisions.
- **Standards compliance:** The WHATWG HTML living standard specifies that if the `lang` attribute is present, its value must be a valid BCP 47 language tag. An empty string is not a valid language tag.

The fix is straightforward: set the `lang` attribute to a valid BCP 47 language tag that matches your content. For English, common values include `en` (general English), `en-US` (American English), or `en-GB` (British English). If your content is in another language, use the appropriate tag (e.g., `fr` for French, `de` for German, `ja` for Japanese).

## Examples

### ❌ Empty `lang` attribute (triggers the warning)

```html
<!DOCTYPE html>
<html lang="">
  <head>
    <title>My Page</title>
  </head>
  <body>
    <h1>Welcome to my website</h1>
  </body>
</html>
```

### ❌ Missing `lang` attribute entirely

While a missing `lang` attribute triggers a different warning, it causes the same underlying problem — no language is declared:

```html
<!DOCTYPE html>
<html>
  <head>
    <title>My Page</title>
  </head>
  <body>
    <h1>Welcome to my website</h1>
  </body>
</html>
```

### ✅ Correct: specifying the language

```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>My Page</title>
  </head>
  <body>
    <h1>Welcome to my website</h1>
  </body>
</html>
```

### ✅ Correct: using a regional variant

```html
<!DOCTYPE html>
<html lang="en-US">
  <head>
    <title>My Page</title>
  </head>
  <body>
    <h1>Welcome to my website</h1>
  </body>
</html>
```

### Using `lang` for mixed-language content

If your document is primarily in English but contains sections in other languages, set `lang="en"` on the `<html>` element and override it on specific elements:

```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Multilingual Page</title>
  </head>
  <body>
    <h1>Welcome</h1>
    <p>This page contains a quote in French:</p>
    <blockquote lang="fr">
      <p>La vie est belle.</p>
    </blockquote>
  </body>
</html>
```
