All Collections
Site Audit
Issues
"HTML lang attribute invalid" error in Site Audit
"HTML lang attribute invalid" error in Site Audit

Learn more about the "HTML lang attribute invalid" issue in Ahrefs' Site Audit and how to fix it on your website.

Nick Churick avatar
Written by Nick Churick
Updated over a week ago

What triggers this issue?

This issue reports page URLs where the language (or language-location) code declared in the HTML lang tag (<html lang="..."> ) is invalid. Language code must adhere to ISO 639-1 format, region code (optional) must be specified in ISO 3166-1 Alpha 2 format.

Example:


...
  <html lang="en-uk">
...

en-uk is not a valid language-region code for the United Kingdom. It must be en-gb  instead.

Why is it important?

Although Google might not be using the HTML lang attribute today, other search engines and programs, such as screen readers, do to understand the language of the page.

How to fix it?

For each reported URL, look at the columns shown in the screenshot below:

bel  in the example above is not a valid language code for Belarusian and must be replaced with be .

If you need a list of all URLs that have a given invalid language or language code, you can easily do it with one additional filter.

Make necessary edits to the HTML lang tag on all reported pages.

Did this answer your question?