In short
Ahrefs flags "Hreflang and HTML lang mismatch" when the language a page declares for itself in hreflang is different from its HTML lang attribute, for example hreflang "de" but <html lang="en">. Google uses hreflang and the visible text, not the lang attribute, but browsers, screen readers and translation tools rely on lang. Check the page's actual language and correct whichever tag is wrong. It's usually the lang attribute, left at the site default.
A page can state its language in two places: the hreflang annotation and the lang attribute on the <html> tag. This issue appears when they disagree.
Which one is wrong?
Read the page. If it's in German, both should say German:
<html lang="de">
<link rel="alternate" hreflang="de" href="https://example.com/de/page/">
| Pattern | Likely cause |
|---|---|
| Every translated page has the default language in lang | Theme hardcodes lang instead of using the current language |
| Only some pages mismatch | Untranslated pages published in the wrong language folder |
| Region missing in one place (de vs de-AT) | Not an error in itself; both describe German |
How to fix it
WordPress: WPML, Polylang and TranslatePress set lang per language if the theme uses language_attributes() in header.php. If yours doesn't, fix the theme.
Shopify: the theme should use <html lang="{{ request.locale.iso_code }}"> in theme.liquid.
Webflow: Localization sets lang for each locale automatically. Check custom code that overrides it.
Wix: Wix Multilingual sets it per language. Check that each page is actually translated.
Custom builds: set lang from the same locale value you use to build hreflang.
This guide isn't affiliated with or endorsed by Ahrefs.
Related issues
Sources and references
Google Search Central, Tell Google about localized versions of your page
Google Search Central, Managing multi-regional and multilingual sites

About the author
Nazmul Nikhil
Head of SEO & Assistant Manager, Digital Marketing at Notionhive
SEO and AI search consultant in Dhaka, Bangladesh, helping small and mid-size businesses in the USA, UK, Australia and Canada.



