HTML Lang: Declare the Primary Language of the Document

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 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.

Run this check on your own page

Open the tool and analyze a public URL to see this section inside the full report.

Back to checker

Continue to your tool account

Use Google or email. New tool accounts are created automatically the first time you continue.

We'll email you a 6-digit one-time code. Entering it on the next screen signs you in and creates your tool account automatically if needed.