HTML lang Attribute: Telling Search Engines and Browsers Your Page's Language
The lang attribute on the <html> element (e.g., <html lang="en">) declares a page's primary language for browsers, screen readers, translation tools, and search engines.
Why it matters
A missing or wrong lang attribute will not tank rankings by itself, but it breaks screen-reader pronunciation, can trigger unwanted browser auto-translate prompts, and removes a signal Google uses alongside hreflang to correctly match language and region variants on multilingual sites. It is a small, inexpensive signal with real accessibility impact.
Screen readers depend on the lang attribute to switch pronunciation rules. A French page with lang="en" reads English pronunciation to blind or low-vision visitors, making the content unintelligible. The impact is immediate and direct for every assistive-technology user on that page.
How it works
Place a lang attribute on the opening <html> tag. The value should be a valid BCP 47 language subtag. Use language-only for broad language declaration (en, fr, de) or language-region for specific locales (en-US, en-GB, fr-CA). Browsers and screen readers read this value and adjust behaviour accordingly.
Google uses the lang attribute alongside hreflang to understand multilingual site structure. On a multilingual site, each locale subdirectory or domain should declare its primary language via the lang attribute. This helps Google understand which page version to show to a user searching in that language.
What does not matter
The lang attribute does not affect search rankings directly. Google is most interested in your content language and hreflang structure. A page with the correct language content but missing lang will still rank, but without the full signal strength and accessibility benefits.
A single lang attribute for the whole page is correct even if the page contains multiple languages in small sections. Do not change lang mid-page or use meta tags to declare language. Use the html lang attribute alone.
Code example
Good: Declare the page's primary language with a valid BCP 47 subtag.
<html lang="en">
<head>
<title>My Page</title>
</head>
<body>
<!-- Content in English -->
</body>
</html>
Broken: Hardcoding lang once across all locale versions, or omitting it entirely.
<!-- On https://example.fr/ (French locale) -->
<html lang="en">
<!-- This page is in French but declares lang="en", confusing browsers and screen readers -->
<body>
Bonjour, welcome to the site!
</body>
</html>
How Scalpel shows it
The Meta panel reports the declared lang value and flags pages missing it. For multilingual sites, Scalpel shows you whether each locale version declares the correct language. A mismatch between the declared lang and the page content will be flagged as a potential issue.