Learn
HTML Lang Attribute: What It Does for Accessibility and Search
One attribute on the html element. Screen readers depend on it to choose a voice; Google mostly ignores it and works out the language from the content.
Run a fresh DomainLens audit and use the report as your priority list.
What it actually affects
The lang attribute declares the language of a document. Screen readers use it to select pronunciation rules — a French page read with English pronunciation is close to unintelligible, so this is a genuine accessibility requirement rather than a nicety.
Browsers use it for hyphenation, quotation marks and to offer translation. Google, by contrast, determines language from the visible content and has said it does not rely on the attribute. That is worth knowing before anyone claims it as a ranking factor.
| Consumer | Uses it? | For what |
|---|---|---|
| Screen readers | Yes, critically | Pronunciation and voice |
| Browsers | Yes | Hyphenation, quotes, translation offer |
| Not really | Language is read from content | |
| Spell checkers | Yes | Dictionary selection |
Correct values
The value is a language tag: a two-letter ISO 639-1 language code, optionally followed by a region subtag. The common mistakes are using a country code alone or inventing a value.
<html lang="en"> <!-- English -->
<html lang="en-GB"> <!-- English, UK conventions -->
<html lang="de"> <!-- German -->
<html lang="uk"> <!-- Ukrainian, not the UK -->
<html lang="pt-BR"> <!-- Brazilian Portuguese -->
<!-- Wrong -->
<html lang="english"> <!-- not a language tag -->
<html lang="gb"> <!-- a country, not a language -->
<html lang=""> <!-- worse than omitting it -->
<!-- Mark passages in another language inline -->
<p>The German word <span lang="de">Fahrvergnügen</span> …</p>
The uk confusion
This one is worth stating explicitly because it recurs constantly: uk is the ISO code for Ukrainian. English as used in the United Kingdom is en-GB.
A British site declaring lang="uk" is telling screen readers to read English text with Ukrainian pronunciation. The same mistake appears in hreflang annotations, where it silently invalidates the entry.
How it relates to hreflang
They are different mechanisms that use similar values. The lang attribute declares what language this page is in; hreflang declares which other URLs are equivalent versions for other audiences. A page needs lang whether or not it has translations, and hreflang only when it does. Keep them consistent — a page with lang="de" listed as the English alternate is contradicting itself. See hreflang tags and the international SEO checklist .
Where it goes wrong in practice
The hardcoded template is the common one on translated sites, and it is invisible in testing because the page looks correct — only a screen reader or a validator notices.
- A template hardcoding lang="en" on every page of a multilingual site.
- A CMS emitting the site default rather than the page language.
- An empty lang attribute, which is worse than none because it asserts unknown.
- Country codes used as language codes, most often uk for the United Kingdom.
- Untagged inline passages in another language, which screen readers mispronounce.
How DomainLens contributes
DomainLens reports the lang attribute a page declares alongside its hreflang annotations, which is where a hardcoded default contradicting the translation set becomes visible. See the on-page SEO checklist for document metadata for the other head-level requirements.
- Does the lang attribute affect SEO?
- Barely. Google determines language from the content. It matters for accessibility, where screen readers depend on it for pronunciation.
- What is the correct value for a UK English site?
- en-GB. The value uk is the ISO code for Ukrainian, which is a common and confusing mistake.
- Do I need lang on every element?
- No — once on the html element, plus a lang on any inline passage in a different language.
- Is lang the same as hreflang?
- No. lang declares this page's language; hreflang lists equivalent pages in other languages. They should agree but they do different jobs.