URL: /rules/a11y/html-xml-lang-mismatch

---
title: "HTML XML Lang Mismatch"
description: "Checks that lang and xml:lang attributes match on html element"
---

Checks that lang and xml:lang attributes match on html element

| | |
|---|---|
| **Rule ID** | `a11y/html-xml-lang-mismatch` |
| **Category** | [Accessibility](/rules/a11y) |
| **Scope** | Per-page |
| **Severity** | error |
| **Weight** | 6/10 |

## Solution

If both lang and xml:lang are present on the `<html>` element, they must have the same base language. Mismatches can cause screen readers to announce content in the wrong language. Typically, you only need lang for HTML5 documents.

## Enable / Disable

### Disable this rule

```toml squirrel.toml
[rules]
disable = ["a11y/html-xml-lang-mismatch"]
```

### Disable all Accessibility rules

```toml squirrel.toml
[rules]
disable = ["a11y/*"]
```

### Enable only this rule

```toml squirrel.toml
[rules]
enable = ["a11y/html-xml-lang-mismatch"]
disable = ["*"]
```
