Skip to content

HTML lang and hreflang: Check the Language of Each Page

Separate the language of an HTML page from its search alternates. See an actual English, Chinese and Malay source check.

Three cream booklets with purple, orange and slate tabs and connecting pencil arrows
Jack Lee
3 Min Read
Share
On This Page

A Malay article can be listed as the right search alternate and still carry an English document-language tag. Search markup and page-language markup do separate jobs. When you check a multilingual template, inspect both along with the words the reader actually sees.

Check what each attribute describes

MarkupDescribesWhere to check
langThe language of this document or a specific passage.Look at the root HTML element and any marked passages in the body. The default language helps software such as screen readers select pronunciation.
hreflangThe audience language or locale of another equivalent URL, including the page’s self-reference.Here, check the alternate links in the HTML head. A site may also provide equivalent information in an HTTP header or sitemap.

Google detects a page’s language from its content. The declarations help with two other tasks: language-aware processing on the page, and identifying alternate URLs in Google Search.

What SEOWithJack’s three versions returned

On 2026-11-19, SEOWithJack fetched the public beginner SEO guide in English, Simplified Chinese and Malay. Each returned HTTP 200. The localized headings and document languages agreed in this sample.

Public pathRoot languageSelf-reference in the alternate set
/what-is-seo/enen-MY
/zh/what-is-seo/zh-Hanszh-Hans
/ms/what-is-seo/ms-MYms-MY

All three pages named the same set of alternatives, and each set returned the other members’ links. Each page’s canonical pointed to itself. The x-default link pointed to the English URL. On the English page, en declares English text, while en-MY labels that URL as the Malaysia-English alternate. Those labels are compatible.

Check the document first, then the alternate targets

  1. Read the page. Check the visible heading and main text, then compare the root language. If the template says English on a Malay page, fix the root language for that page.
  2. Mark meaningful passages in another language. Put a language attribute on the element around the translated quotation or passage. For instance, <span lang="ms">Selamat datang</span> marks a Malay greeting inside an English article.
  3. Follow each alternate. Check that it resolves to the equivalent page in the declared locale, with matching return links. Look for paths that redirect to the wrong default or only change the header language. Use the three-language hreflang audit to check the full group, and review language redirects if direct visits switch versions.

These public checks confirm what the pages emit. Test how your assistive technology reads the article separately and use your own search data to investigate which URLs appear.

Frequently asked questions

When should I use hreflang?

Use it when the same content has separate language or regional URLs. Set the page’s document language even if it has only one version.

Must lang and hreflang match character for character?

They can differ in specificity. English text can use a generic document-language tag while its alternate indicates an English audience in a particular region. Verify both describe the intended page correctly.

Will language attributes translate my page?

They describe existing text or point to an existing alternate. The reader still needs an actual translated page or passage.

Share This Article