# HTML Lang: Declare the Primary Language of the Document

> Why the HTML lang attribute matters for accessibility, translation, and page interpretation.

Canonical: https://softwareontheweb.com/tools/launch-readiness-checker/html-lang

Browsers, screen readers, and translation systems all benefit from knowing the page language up front.

The `lang` attribute is a small but foundational signal.

## What It Is

The HTML `lang` attribute is placed on the root `<html>` element and identifies the primary language of the document.

```html
<html lang="en">
```

## Why It Matters

- Screen readers use it to choose pronunciation rules.
- Browsers and translation tools use it for language-aware behavior.
- It reduces ambiguity for multilingual or international content.

## Best Practices

1. Set the root language on every page.
2. Use the right value, such as `en`, `en-US`, or `fr`.
3. Update the value when a page is served in another language.

## Common Mistakes

- Leaving the attribute out.
- Using the wrong language code site-wide.
- Forgetting to update it on localized pages.

## Quick Checklist

- One `lang` attribute on `<html>`.
- Correct language code.
- Localized pages use localized values.

## Final Takeaway

Language declaration is low effort and high value. There is little reason to ship without it.

## Related
- [Home](https://softwareontheweb.com/)
- [Topics](https://softwareontheweb.com/topics)
