HTML lang attribute missing: screen readers left guessing the language
Last reviewed
Without a page language, screen readers have to guess.
A missing lang attribute means the opening tag of your page's code does not say what language the page is written in. Screen readers then fall back to the listener's own device settings and may mispronounce your words, and browsers can misjudge whether to offer a translation. It fails WCAG 3.1.1 Language of Page, and the fix is a single edit to your site template.
Why a missing lang attribute costs you customers
Most visitors will never notice, which is why this one can wait for a convenient moment. The people who do notice are the ones it affects most: a screen reader user whose device is set to Spanish may hear your English service page read with Spanish pronunciation, which can be close to impossible to follow. Browsers that offer translation can also guess wrong and prompt visitors to translate a page they could already read.
What usually causes a missing lang attribute
- A hand-coded or custom-built template that was never given a language setting
- A theme or page builder that writes its own page wrapper and leaves the attribute out
- The site language in your website platform settings was left blank or set to the wrong language
- Landing pages exported from a design program or built in a separate page service
How to check for a missing lang attribute yourself
- On a computer, open your homepage in Chrome, right-click an empty part of the page and choose "View page source".
- Find the tag near the top that begins with <html. If it includes lang="en", lang="en-US" or another language code, the setting is in place. If it reads just <html> with nothing about language, it is missing.
- Repeat on one page of each type, such as a blog post, a service page and a landing page, because they can come from different templates.
- If your site runs on WordPress, open Settings, then General, and confirm that Site Language matches the language your pages are written in.
How to fix a missing lang attribute
- Confirm the main language of your site and note any pages written in another language, such as a Spanish version of your services page. You know this best.
- If you use a website platform, set the site language in its settings first, since many themes read that setting and write the attribute for you. You or your web person can do this.
- Have your developer add lang="en" (or the right code, such as lang="es" for Spanish) to the <html> tag in the main site template, so every page inherits it.
- For a page in a different language, your developer gives that page its own lang value, and marks any paragraph in a second language with a lang attribute of its own.
- Ask your developer to confirm the language setting on every new template or landing page, and to recheck it after theme updates so it does not quietly disappear.
How Prsona catches a missing lang attribute
Prsona checks whether your pages declare their language and raises a low-urgency finding when they do not, so the one-line fix lands on your list instead of being forgotten.
Prsona looks for a missing lang attribute as part of accessibility monitoring.
See whether your pages tell screen readers and browsers which language they use.
Questions about a missing lang attribute
Which lang code should my website use?
Use the code for the language your pages are written in, such as "en" for English or "es" for Spanish. You can add a region, like "en-US" or "en-GB", but the plain language code is enough for most local businesses. What matters is that the code matches the words on the page.
Does a missing lang attribute hurt my Google ranking?
Not directly. Google says it works out a page's language from the visible text and does not use code-level signals such as the lang attribute. The reasons to fix it are accessibility and sensible translation prompts, and for a developer it is a very small job.