# HTML lang and hreflang: language declarations for agents

> Language declaration and multilingual access: A wrong language tag makes an agent misread the content. The fix: add a language declaration and hreflang.

- Source: /checks/lang
- Site: AgenticWebScore
- Language: English

---
A wrong language tag makes an agent misread the content.

| Property | Value |
| --- | --- |
| Check id | `lang` |
| Dimension | Content Accessibility (22%) |
| Tier | Recommended — pool 20 pts |
| Weight inside tier | 1 |
| Impact | Medium |
| Maturity | Adopted — A ratified standard with real deployment. |
| Conditional | No |
| Publishing skill | `language-declaration` |
| Standards | — |

## What is measured

The scanner reads the `lang` attribute of the root `<html>` element on the homepage `/` and, when present, every `<link rel="alternate" hreflang="...">` value. Pass when `lang` is a well-formed language tag (`en` or `en-GB`, primary subtag matching the visible language) and each `hreflang` is a tag whose `href` is an absolute URL that returns that language; partial when `lang` is empty or malformed, or when alternates exist without a self-referencing entry and an `x-default`; fail when the page declares no language at all and has no `<meta http-equiv="content-language">` fallback.

## Reproduce it yourself

You do not have to take our word for any of this. Run the same measurement against your own domain:

```bash
DOMAIN="https://example.com"
curl -sL "$DOMAIN/" | perl -0777 -ne 'm{<html[^>]*\blang=["\x27]?([^"\x27\s>]+)}i and print "html lang=$1\n"; while (m{<link[^>]*\bhreflang=["\x27]([^"\x27]+)["\x27][^>]*>}gi) { my ($hl,$h)=($1,undef); ($h) = $& =~ /\bhref=["\x27]([^"\x27]+)/i; print "hreflang=$hl href=", (defined $h ? $h : "MISSING"), "\n" }'
```

## The fix

This is the artifact to ship. It is the complete change, not a description of one.

```html
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="alternate" hreflang="en" href="https://www.example.com/" />
    <link rel="alternate" hreflang="de" href="https://www.example.com/de/" />
    <link rel="alternate" hreflang="x-default" href="https://www.example.com/" />
  </head>
  <body>
    <!-- one language per URL: never mix translations on the same page -->
  </body>
</html>
```

> Tags are case-insensitive but use a hyphen, never an underscore (`en-GB`, not `en_GB`), and every `hreflang` href must be absolute and actually resolve.

## Related checks

| Check | Tier | Impact | Same skill |
| --- | --- | --- | --- |
| `markdown-negotiation` — Markdown content negotiation | Recommended | Critical | — |
| `headings` — Semantic heading structure | Essential | High | — |
| `meta` — Title and summary metadata | Essential | High | — |
| `jsonld` — JSON-LD structured data | Essential | Critical | — |
| `faq-schema` — FAQ / question-answer schema | Recommended | High | — |
| `breadcrumb` — Breadcrumb / navigation schema | Emerging | Low | — |
| `summary` — Prominent summary block | Recommended | Medium | — |
| `no-js-fallback` — Content that needs no JavaScript | Essential | High | — |
