Detector registry

HTML lang Attribute: An Accessibility Signal Worth Checking

A missing <html lang> attribute is a common accessibility gap. See what WCAG 3.1.1 expects and how LaunchTrust detects the signal before you ship.

Updated 2026-06-19html lang attribute accessibilitySignals, not a verdict

The lang attribute on your page's root <html> element tells browsers, screen readers, and translation tools which human language the content is written in. It is one line of markup, easy to forget, and one of the most frequently missing accessibility signals on launch-day landing pages and web apps shipped by small teams.

If you are putting a site in front of users in the EU — or in front of an app-store reviewer who pokes at your marketing site — a declared page language is a small, concrete trust signal. LaunchTrust looks for it so you can catch the gap before someone else does.

What LaunchTrust checks

The page-language detector (a11y_lang) inspects the raw HTML returned for the URL you scan. It looks for an opening <html> tag carrying a lang attribute whose value begins with a letter — for example <html lang="en">, <html lang="tr">, or <html lang="pt-BR">.

  • Detected — the <html> tag has a lang attribute with a language value present. This is the signal you want; it is reported as informational.
  • Not detected — the <html> tag has no usable lang attribute. This is flagged at medium severity, referencing WCAG 3.1.1 (Language of Page).

This is a positive signal: detected means the thing you want is present; not-detected means it is missing. The check is a presence test on the root element only. It does not validate the tag against BCP 47, and it does not verify that the declared language matches the words on the page — a page tagged lang="en" but written in German would still read as "detected." Treat the result as a signal that the declaration exists, not as proof that it is correct.

Why it matters

Declaring the page language maps directly to recognized accessibility expectations:

  • WCAG 3.1.1 (Language of Page) is a Level A success criterion. It expects the default human language of each page to be programmatically determinable. A missing root lang attribute is a textbook failure of this criterion.
  • The European Accessibility Act drives many private-sector digital products (including e-commerce and consumer-facing apps) toward WCAG-aligned accessibility. Where the EAA applies, basics like a declared page language are commonly expected as part of conforming to the referenced standard.

Practically, the lang value tells a screen reader which pronunciation rules and voice to use. Without it, an English page may be read aloud with German phonetics — confusing for users who rely on assistive technology. Browser auto-translate and search engines lean on it too.

A concrete example

A missing declaration versus the one-attribute fix:

<!-- not detected -->
<html>
  <head><title>My App</title></head>

<!-- detected -->
<html lang="en">
  <head><title>My App</title></head>

For regional variants, use a full tag such as lang="en-GB", lang="pt-BR", or lang="fr-CA". Use the language your content is actually written in — a declared value that contradicts the text is worse than helpful.

How to address it

  1. Open your root HTML template. In a static site this is index.html; in a framework it may be app/layout.tsx (Next.js), src/app.html (SvelteKit), or your base layout file.
  2. Add lang to the <html> tag with the primary language of the page, e.g. <html lang="en">. Add a region subtag only if you genuinely serve a regional variant.
  3. Match the declaration to the content. If the page is in Turkish, set lang="tr", not lang="en".
  4. Handle multilingual pages. Set the root lang to the page's main language, then mark inline passages in another language with a lang attribute on that element (e.g. <span lang="fr">…</span>).
  5. Set it dynamically if you localize. If your app switches languages at runtime, update the root lang attribute to track the active locale.
  6. Re-scan to confirm the signal now reports as detected.

Check this in 30 seconds

Paste your URL into LaunchTrust's free scanner and it reports whether your <html> element declares a language — alongside other accessibility signals like page title, image alt text, and form labels. You get a plain list of detected / not-detected signals to act on before you ship.

FAQ

Does adding a lang attribute satisfy accessibility requirements? No. It addresses one accessibility signal. LaunchTrust reports whether the declaration is present; it does not certify your app, prove conformance, or provide legal advice. A declared page language is one expected basic among many — treat it as a gap-finder, not a verdict.

What value should I use for the lang attribute? Use the language your content is written in, as a BCP 47 tag: en, de, tr, or a region variant like en-GB or pt-BR. The scanner checks that a value is present, not that it is correct, so choose it carefully.

Will the scanner catch a wrong language value? No. The detector confirms a lang attribute with a language value exists on the <html> element. It cannot tell that lang="en" was set on a page written in French, so verify the value matches your content yourself.

My page is a single-page app — does the lang attribute still matter? Yes. The root <html> element is served before your JavaScript runs, so set lang in the base template. If your SPA switches locales at runtime, update the attribute when the language changes.

Compliance aid, not legal advice. LaunchTrust reports signals, not a verdict or certification.