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.

We use cookies so you can have a great experience on our website. View more
Cookies settings
Accept
Decline
Privacy & Cookie policy
Privacy & Cookies policy
Cookie name Active

Who we are

Our website address is: https://nkyseo.com.

Comments

When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor’s IP address and browser user agent string to help spam detection. An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.

Media

If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.

Cookies

If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year. If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser. When you log in, we will also set up several cookies to save your login information and your screen display choices. Login cookies last for two days, and screen options cookies last for a year. If you select "Remember Me", your login will persist for two weeks. If you log out of your account, the login cookies will be removed. If you edit or publish an article, an additional cookie will be saved in your browser. This cookie includes no personal data and simply indicates the post ID of the article you just edited. It expires after 1 day.

Embedded content from other websites

Articles on this site may include embedded content (e.g. videos, images, articles, etc.). Embedded content from other websites behaves in the exact same way as if the visitor has visited the other website. These websites may collect data about you, use cookies, embed additional third-party tracking, and monitor your interaction with that embedded content, including tracking your interaction with the embedded content if you have an account and are logged in to that website.

Who we share your data with

If you request a password reset, your IP address will be included in the reset email.

How long we retain your data

If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue. For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.

What rights you have over your data

If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.

Where your data is sent

Visitor comments may be checked through an automated spam detection service.
Save settings
Cookies settings