HTML code with the human language attribute
Image description: A code editor displaying well-labeled HTML with the human language attribute. The code in the editor is displayed below.

<html lang=”en-US”> <p lang=”es-MX”>Oh Dios mío!</p> <p>In Chinese, <span lang=”zh-CN”>我的天!</span></p>

This page is in progress -

If you would like to contribute or make a case to prioritize this page, please fill out the form below.

Why This is Important

The correct language attribute ensures that screen readers process the content in the intended language.

Blind and visually impaired people use screen readers to interact with websites and apps. A screen reader is a type of assistive tech that converts things on screen to audio and/or braille. It's important that things are understandable and interactive to screen readers.

Keyboard accessibility is essential for people who do not use a computer mouse (which might be because they have unpredictable or very specific movement due to a motor disability). Many Blind and visually impaired people also use keyboard interactions in order to use their screen reader.

Error support is accessible to people with a diversity of disabilities. A cognitive disability might affect how a person perceives and understands things. A physical disability might lead to unpredictable movement. Other factors such as environment, stress, and multi-tasking may also lead to errors.

In order to be accessible, gestures and interactions must account for people with physical and motor disabilities, who might have unpredictable or very specific movement.

In order to ensure the screen reader user experiences content in the intended human language, the human language attribute must be correctly labeled.

This references WCAG criteria 3.1.1 Language of Page (Level A) and 3.1.2 Language of Parts (Level AA).

Level AAA compliance is considered more difficult to meet because it requires more resources to fulfill. It also might encompass conflicting access needs (meaning what is accessible to some might be inaccessible to others). Use your best judgment of your target audience and your team's capabilities to determine if this is a pragmatic goal to reach.

How to Implement This

Language of the Page

Add the language attribute to each page with the correct language code.

HTML Language Code Reference

<html lang="en-US">
<p>It's a beautiful day to not wear pants.</p>

Language of Phrases and Passages

For individual phrases and passages that differ from the page language, use the span element.

<p>Hungarians refer to themselves as <span lang="hu">magyarok</span>.</p>

Note on "Programmatically Determined"

WCAG often uses the phrase "programmatically determined" to mean that an element is defined in markup (HTML) and therefore available for assistive tech to access. I use the term "defined in markup" instead because I find it more simple and understandable. Just keep this in mind when reading WCAG source material.

How to Test This

Manual Test
Semi-Automated Test
Automated Test

Use an automated testing tool such as Deque Axe or IBM Accessibility Checker to test for human language attribute.


No credits yet. But this could be you!

Code snippets written by Michellanne Li.

Contribute and Give Feedback

If you would like to provide feedback or contribute content on this resource, please fill out the form below.

Thank you, your submission has been received!
Oops! Something went wrong while submitting the form. Please check your internet connection and try again.

If you continue to encounter issues, please reach out to alexyingchen(at)