SEO issue explained

Missing lang attribute

The page's tag has no lang attribute, so browsers, screen readers and translation tools have to guess what language the page is in.

A friendly robot examining a web page with a magnifying glass, surrounded by charts and check marks

What this issue means

ROC SEO reports a missing lang attribute under check O12. The fix is one attribute: <html lang="en">.

Why it matters

Screen readers use the language to choose the right pronunciation, browsers use it to offer translation, and it is required by the WCAG accessibility guidelines. Google says it does not use the lang attribute to detect language, but it is still part of a well-built page.

How to fix it

  1. Add the language code to the html tag: en for English, ur for Urdu, de for German.
  2. Add a region if it matters: en-GB, pt-BR.
  3. In WordPress, set the site language under Settings › General; most themes then print it automatically.
  4. For pages in several languages, mark sections in another language with their own lang attribute, and use hreflang tags between translations.

Find it on your own site

The free ROC SEO extension checks the page you are on for this and more than 60 other issues, each with a fix, and the site crawler checks up to 1,000 pages for free.

Related issues

Frequently asked questions

Does Google use the lang attribute?

Google has said it detects the language from the content, not the lang attribute. It is still important for accessibility and browsers.

Is lang the same as hreflang?

No. lang names the language of the page itself; hreflang links a page to its versions in other languages.

What if my page mixes languages?

Set the main language on the html tag and add lang to elements written in another language.

Get in touch

Questions, ideas or a partnership?

Write to us about anything: a guest post or publishing on our blog, a partnership, an update you would like to see, a problem with the extension, billing or a refund. A person reads every message and replies by email.

Prefer email? Write to support@getrocseo.com.