Define the language of the page

Last updated:

How to define the language of the page?

Add a lang attribute to the html element with a valid language code.

For English this would be:

<html lang="en">
    <!-- content -->
</html>

Valid language codes are either two-letter or three-letter language codes. You can find the list of valid language codes in the ISO 639-1 code list.

Why is this important?

The use cases for the <html lang> attribute are:

  • Screen readers
  • Translation such as Google Translate
  • Spellchecking
  • Localized date and time input

It is crucial to define a valid lang attribute on the html tag. A screen reader uses the lang attribute to select the corresponding language to speak the text if that language is available.

More info:

WCAG 3.1.1 Language of Page.

Rule info

Standard

WCAG A SC 3.1.1

Regulations

EN 301 549 RGAA EAA AODA

User impact

Fix complexity

Affects

Was this article helpful?

Checkout the ExcellentWebCheck services

ExcellentWebCheck's goal is to improve the online user experience. The tools of ExcellentWebCheck help to detect and improve usability problems on your website.