The HTML lang attribute doesn't directly improve your Google rankings. Google identifies a page's language from its content rather than relying on this attribute.
That doesn't mean you should leave it out. The attribute gives browsers and assistive technology a language cue that can make your page easier to use.
Let's look at where it belongs, how to add it, and when you also need hreflang.
How the HTML lang Attribute Relates to SEO
The lang attribute identifies the primary language of an HTML document. It sits on the opening <html> element and applies to the page unless a smaller section has its own language declaration.
For Google Search, the distinction is clear. Google's guidance on multilingual sites says it uses visible page content to determine language, not the HTML lang attribute or the URL.
We recommend adding the attribute for accessibility and accurate language identification by other tools. Just keep your SEO expectations realistic. A language declaration won't replace useful content, clear page structure, or a site that search engines can access.
Why the Lang Attribute Matters for Accessibility
Think of the attribute as a language label for the page. It gives software a way to identify the language without guessing from individual words.
Screen readers can choose the right pronunciation
A screen reader can use the declared language to select an appropriate voice or pronunciation rules. Without that information, a visitor may hear words pronounced according to the wrong language settings.
The W3C's Language of Page guidance explains that a page's default language should be identifiable by software. Adding lang to the root HTML element is a straightforward way to provide that information.
Individual passages can use another language
If a passage switches languages, you can add a lang attribute to the element around that passage. The rest of the page continues to use the language declared on the root element.
This can help assistive technology handle the change in pronunciation. The W3C's Language of Parts guidance explains how language information supports passages written in another language.
How to Add the HTML Lang Attribute
Start with the language used for most of the page. If your site has separate language versions, each page should declare the language of its own content.
Add the attribute to the opening HTML tag
Here's a complete, minimal example for a page written in British English:
<!doctype html><html lang="en-GB"><head><title>Welcome</title></head><body><p>Hello.</p></body></html>
The important part is lang="en-GB" on the opening <html> tag. The code identifies English and adds a region for Great Britain. Your page will have more content, but the attribute belongs in the same place.
Use a valid language tag that matches the page. For example, en-GB is valid, while en-UK is a common mistake.
Set the language in your website platform
If your website uses a content management system, the page template may create the opening HTML tag for you. In WordPress, you can set the site language under Settings > General > Site Language.
After making a change, open a published page and use your browser's page source view to find the opening <html> tag. Look for the lang value and make sure it matches the page's main language.
For sites with several versions, review a page from each version. A shared template can accidentally apply the same declaration everywhere.
How Lang Differs From Hreflang
The HTML lang attribute describes the language of the page a visitor is viewing. hreflang identifies related alternate pages intended for different languages or regions.
For example, a business might offer separate English pages for customers in the US and UK. The pages may have different spelling, prices, or shipping details. Hreflang helps Google understand which version is intended for each audience.
Google's localized page guidance explains that Google doesn't use hreflang or lang to detect a page's language. Hreflang helps Google select an appropriate alternate when those pages exist.
If you have one language version for one audience, you usually don't need hreflang. You should still declare the page's language. Our guide to hreflang tags covers the setup for sites with multiple versions.
Common Language Markup Mistakes to Avoid
The most common problem is a mismatch between the declaration and the page content. For example, changing the visible language without updating the template can leave assistive technology with the wrong cue.
Also, avoid treating hreflang as a replacement for lang. They have separate jobs, so multilingual sites may need both. A canonical tag has another purpose: it identifies a preferred URL among duplicate or similar pages.
For genuine regional alternatives, keep canonical and hreflang instructions consistent. Each alternate should identify the other pages in its group, and those pages should return the reference. Use valid codes and live, absolute URLs.
Include these checks in a broader technical SEO audit, alongside crawlability and indexing. That gives you a clearer picture than looking at one attribute alone.
Give Every Page the Right Language Label
The HTML lang attribute won't directly boost your Google rankings, but it helps make your content more accessible. Google reads the page's text to identify its language.
Start by reviewing the opening HTML tag on an important page. Then update any templates or language versions that have a missing or incorrect declaration.





