We'd like to set Google Analytics cookies to learn how people use the Knowledge Base, so we can improve it. We set them only if you accept.

Skip to main content
Digital Accessibility Knowledge Base

html-has-lang

Web validation

The <html> element must include a valid lang attribute that reflects the page’s primary natural language.

The lang attribute enables browsers and assistive technology to deliver correct pronunciation, spell-checking, and font selection. When it is missing or invalid, people who rely on screen readers can find the content confusing or unintelligible, and search engines may misclassify the page. Always provide a short, valid ISO 639 language tag (en, fr-CA, and so on) on every page.

Pass Patterns

<html> element with a lang attribute

The page declares the primary language with a valid tag.

HTML
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Example</title>
    </head>
    <body>
        <p>Hello world!</p>
    </body>
</html>

Fail Patterns

<html> element with no lang attribute

The page omits the lang attribute, so the language cannot be determined.

HTML
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Missing lang</title>
    </head>
    <body>
        <p>Hello world!</p>
    </body>
</html>

WCAG techniques

Sufficient techniques

ACT Rules

Try It Yourself

Inspecting the browser dev-tools

  1. Open the page in a browser.
  2. Open Developer Tools and switch to the Elements panel.
  3. Select the root <html> element.

Expected result: The <html> element has a non-empty lang attribute.

Actual result: The <html>’s lang attribute is missing or empty.

FAQ

How does this issue relate to 3.1.1 Language of Page?

SC 3.1.1 requires that the default human language of each web page be programmatically determinable. Declaring lang on the <html> element meets this requirement by making the language explicit to user agents and assistive technology.

Why is this issue marked as Serious?

Misidentified language immediately affects comprehension for screen reader users and can hamper text-to-speech, translation, and search indexing. The fix is straightforward, but the impact on user experience is significant across browsers and assistive technology, so the severity is classified as Serious.

Standards and Regulations

StandardSuccess CriterionReference
WCAG 2.23.1.1 Language of Page (A)The default human language of each web page can be programmatically determined.
EN 301 5499.3.1.1 Language of PageSame as the WCAG text.

Personas impacted by this issue