In short
Ahrefs flags "Hreflang defined but HTML lang missing" when a page has hreflang annotations but no lang attribute on its <html> tag. Search engines use hreflang, so rankings aren't directly affected. But screen readers, browser translation and other tools rely on lang, and on a multilingual site getting it wrong means pages are read aloud in the wrong accent. Add a lang attribute that matches each page's own hreflang value.
The site has done the harder part, hreflang, but skipped the simple one.
The fix
On the German page with hreflang="de" for itself:
<html lang="de">Where to set it
WordPress: make sure the theme's header.php uses <html <?php language_attributes(); ?>>. Multilingual plugins then set the right language per page.
Shopify: theme.liquid should open with <html lang="{{ request.locale.iso_code }}">.
Webflow and Wix: both set lang automatically with their localization features. If it's missing, check custom code that replaces the page head.
Custom builds: set lang from the page's locale in the root layout. In single-page apps, set it in the server-rendered HTML, not only with JavaScript after load.
This guide isn't affiliated with or endorsed by Ahrefs.
Related issues
Sources and references

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.



