HTML Lang Attribute Auditor
Free HTML lang attribute checker: find missing or invalid lang codes, pages in another language, and conflicts with hreflang and Content-Language.
Still loading. If the tool doesn’t appear, reload this page.
About this tool
HTML Lang Attribute Auditor
Crawl your site to check every page's <html lang>: missing or invalid codes, content written in another language, and conflicts with hreflang, Content-Language, og:locale and locale folders.
An HTML lang attribute checker makes sure every page tells browsers, screen readers and search engines which language it is written in. Enter your website (or paste URLs) and the tool crawls up to 50 pages and reads the lang attribute on the <html> element. It flags pages with no lang at all, empty values, codes that are not valid language tags, and the classic mistakes: en_US with an underscore, en-UK instead of en-GB, and country codes used as languages such as jp, cn, gr or se. It then detects the language the main text is actually written in and compares it with the declaration, so you catch translated pages that still say lang="en" because of a shared template. Each page is also checked against its own self-referencing hreflang, the Content-Language HTTP header and meta tag, og:locale, xml:lang and locale folders or subdomains like /de/ or fr.example.com. Results come with a site-wide summary, per-page details and CSV export. Your input is sent to AltFTool's own server to get the result.
How to use HTML Lang Attribute Auditor
- 1
Enter your homepage, or a language section such as /de/, and choose how many pages to crawl; or paste a list of URLs from each language version.
- 2
Run the audit and start with errors: missing lang, invalid codes and content in a different language.
- 3
Check warnings where hreflang, the Content-Language header or the URL folder disagree with lang.
- 4
Fix the template or CMS setting that outputs lang for each language version.
- 5
Download the CSV, then re-run the audit to confirm every page passes.
Why use HTML Lang Attribute Auditor
Real language detection
Compares the declared language with the language the page text is actually written in.
All language signals
Checks hreflang, Content-Language header, meta content-language, og:locale, xml:lang and locale folders together.
Fix suggestions
Invalid codes come with the correct value, such as en-GB for en-UK or ja for jp.
Site-wide view
See every lang value used on the site and the languages detected, page by page.
Why the HTML lang attribute matters
The lang attribute is required for accessibility (WCAG success criterion 3.1.1): screen readers use it to choose the voice and pronunciation, and browsers use it for hyphenation, spell checking and translation prompts. Google says it detects language from the content rather than from lang, but a wrong lang still creates conflicting signals, and Bing uses the Content-Language header and lang as hints. For multilingual sites, a correct lang on every language version is part of a clean international setup.
What are correct lang values?
Use a BCP 47 language tag: a two- or three-letter ISO 639 language code, optionally followed by a script and a country, separated by hyphens. Examples: en, en-GB, en-US, de-AT, fr-CA, es-419 (Latin American Spanish), zh-Hant-TW. Common mistakes are underscores (en_US), wrong country codes (en-UK, which should be en-GB) and country codes used as languages (jp for Japanese should be ja; cn should be zh; se should be sv).
Lang attribute vs hreflang
The lang attribute describes the language of the page you are on. Hreflang annotations tell search engines which other URLs are alternate language or country versions of that page. They should agree: a page whose self-referencing hreflang is de-DE should have lang="de" or lang="de-DE". Use the Hreflang Validator to check the annotations and return links themselves.
Common use cases
- A multilingual shop finds its German product pages still say lang="en" because the theme hard-codes it.
- A WordPress site with a translation plugin discovers lang="en_US" (underscore) on every page and fixes the setting.
- An agency verifies that each country site (en-GB, en-AU, de-DE) declares the language its hreflang promises.
- An accessibility audit confirms screen readers will use the right pronunciation on every page.
Frequently asked questions
Does Google use the lang attribute?
Google has said it relies mainly on the visible content to work out a page's language and largely ignores lang. Other search engines, browsers and assistive technology do use it, and a mismatch is still a sign of a template problem worth fixing.
Link to answerHow is the content language detected?
The tool reads the main text of each page, skipping navigation, footers, code and passages marked with their own lang, and compares the frequency of common words in 16 European languages; non-Latin scripts are recognised by their characters. About 40 words are needed for a confident result.
Link to answerShould I include the country in lang?
It is optional. lang="en" is valid everywhere. Adding the country, such as en-GB, can help screen readers pick the right accent and keeps lang consistent with region-specific hreflang.
Link to answerIs en-UK valid?
No. The ISO country code for the United Kingdom is GB, so British English is en-GB.
Link to answerWhat about the Content-Language header?
If your server sends Content-Language, it should match the page's language. A site-wide header that always says en on translated pages is flagged.
Link to answerIs anything stored?
No. We read each page's lang attributes and Content-Language header when you run the audit and keep no record of the results.
Link to answer