Lang attribute
What is lang attribute?
The lang attribute is an HTML attribute that declares the human language of an element’s content, set on the <html> element to cover the whole page. Its value is a language code such as en, fr or de, optionally followed by a region, as in en-GB or pt-BR.

You can also set lang on a smaller element when part of a page is in a different language, for example a quotation in French on an English page. The codes follow the BCP 47 standard, the same family of codes used in hreflang.
Why lang attribute matters for SEO
Screen readers use the lang attribute to choose the right pronunciation, so a missing or wrong value makes a page hard to follow for blind and partially sighted visitors. Browsers use it to offer translation, pick hyphenation rules and choose fonts, and accessibility checks such as Lighthouse flag a missing lang.
Google has said it works out a page’s language from its visible content and does not rely on the lang attribute. That does not make the attribute pointless for SEO: other search engines and tools may use it, and it is part of a clean, accessible page. For targeting languages and regions in Google, use hreflang and separate URLs per language, as described in international SEO.
How to set the lang attribute
- Add lang to the <html> element of every template, matching the main language of the content.
- Add a region subtag only when it is meaningful, such as en-GB versus en-US.
- On multilingual sites, make sure each language version sets its own value rather than inheriting the default.
- Mark passages in another language with lang on the containing element.
Lang attribute example
<html lang="en-GB">
...
<blockquote lang="fr">Je pense, donc je suis.</blockquote>
</html>Lang attribute FAQ
Does Google use the lang attribute?
Google has said it detects a page’s language from the visible content and does not use code-level language information such as the lang attribute. Use hreflang to point Google at language versions.
What is the difference between lang and hreflang?
lang declares the language of the current page’s content. hreflang lists the other language or regional versions of the page so search engines can show the right one.
Related SEO terms
Hreflang is an annotation that tells search engines which language or regional version of a page to show to which searchers.
International SEO is optimising a site to rank in several countries or languages, using the right URL structure, hreflang and localised content.
Technical SEO is making sure search engines can crawl, render and index your site, covering speed, redirects, canonicals, sitemaps and mobile.
Lighthouse is Google’s open-source tool that tests a page in a lab and scores its performance, accessibility, best practices and SEO.