In short
Ahrefs flags "HTML lang attribute missing" when a page's <html> tag has no lang attribute. Google detects language from the visible text, so this isn't a ranking issue. It is an accessibility requirement: without it, screen readers may read the page with the wrong pronunciation, and browsers may offer to translate a page that's already in the reader's language. Add lang="en" (or your language) to the html tag.
This applies to every site, including single-language ones.
The fix
<!DOCTYPE html>
<html lang="en">
Use en-US or en-GB if you want to be specific; en alone is fine for most English sites.
Why it matters
Accessibility: WCAG 2.2 success criterion 3.1.1, Language of Page, is level A, the minimum standard many accessibility laws refer to.
Browsers: translation prompts, spell-checking, hyphenation and font choices use it.
Search: Google doesn't use code-level language information such as lang, but other tools may.
Where to set it
WordPress: Settings > General > Site Language, with a theme that calls language_attributes().
Shopify: theme.liquid, first line of the html tag.
Webflow: set the site language in Site settings (Localization for multi-language sites).
Wix: Settings > Language & Region.
Custom builds: add it to the root index.html or layout component.
This guide isn't affiliated with or endorsed by Ahrefs.
Related issues
Sources and references
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.



