What is Page language (html lang)?
Also called: lang attribute, Language declaration
The lang attribute sits on the first tag of your page code, for example <html lang="en">. It names the language of your text with a short code, such as en, nl or pt-BR.
Why it matters
Screen readers use it to pick the right voice and pronunciation, and browsers use it to offer translation. It helps accessibility more than it affects search.
How Onbiom checks it
Two checks. Page language passes when the html element in the first-loaded HTML has a lang attribute with text.
Language code looks only at the form of the code: a short language code, with hyphens and an optional country, such as en-GB. Something like en_US fails. Onbiom does not check that the code matches the language of your text.
In your report this appears as: Declared page language; Well-formed page language code.
How to check it yourself
- Open your homepage and choose View page source.
- Look at the very first <html ...> tag for lang="..." and check the code is a short code with a hyphen, not an underscore.
curl -s https://example.com/ | grep -io "<html[^>]*>"Not sure about your own site? Paste your address and see in a minute which of these checks your site passes. Free, no account needed.
How to fix it
- WordPress
- Set the site language under Settings, then General. Themes then write it into the html tag.
- Shopify
- The theme sets it from your store language under Settings, then Languages.
- Wix
- Set the site language in the Wix language settings.
- Any website
- Ask your web person or hosting company to make the change, and send them the wording from your report.
Related terms
Sources and further reading
Last reviewed: