Skip to content
Technical

lang attribute

Also known as: html lang · language attribute · page language

The attribute applies to the element and everything inside it. You usually set it on the <html> element. Browsers and assistive technologies such as screen readers use it, for example to read text aloud with the correct pronunciation. You use language codes such as en, optionally with a region: en-GB.

Why it matters

A common misunderstanding: Google does not use the lang attribute to determine a page's language. Google says it looks at the visible content. The attribute is therefore no substitute for hreflang. It is still needed for accessibility and for other software that processes your pages.

What to do

  • Set lang on the <html> element, with the language of the page.
  • Use lang on an individual element if it contains another language.
  • For multilingual sites, also use hreflang and a separate canonical URL per language.

Sources

  1. MDN: lang (HTML global attribute)
  2. Google Search Central: Managing multi-regional and multilingual sites

Related terms

← All terms

How does your site perform?

The free scan checks your technical setup and measures whether ChatGPT, Gemini, Claude and Perplexity mention you.

Start free scan