Skip to main content

Fix Guides

How to Fix a Missing HTML Language Attribute

Tell browsers and screen readers which language to use.

Quick fix

To fix a missing language attribute, add lang="en" (or the correct ISO code, e.g. en-GB, fr) to your <html> opening tag: <html lang="en">. In WordPress, set the site language in Settings → General. Re-scan to confirm.

The lang attribute tells screen readers which pronunciation rules to use and helps search engines understand your content's language. Missing lang is a common, one-line fix with outsized accessibility impact.

Check your website

See how your site handles how to fix a missing html language attribute — free, no account needed.

Business impact

Without lang, screen readers may mispronounce your content in the wrong language voice — making the site unintelligible for blind users. It is a WCAG requirement and takes minutes to fix.

Why this happens

Missing when theme templates omit lang on <html>, custom static sites forget it, or SPAs render without updating the document element. Use ISO 639-1 codes. For multilingual pages, set lang on inline elements when content switches language.

How to confirm the issue

Manually: View Source — first line should be <html lang="en"> or similar.

With Plexa Trust: "Language Attribute Missing"; re-scan after fix.

Step-by-step fix

  1. Identify the primary language of your site.

  2. Add lang="xx" to the <html> element in your base template.

  3. For WordPress, verify Settings → General → Site Language.

  4. On multilingual pages, add lang to elements with foreign-language content.

  5. Re-scan to confirm.

Platform-specific fixes

WordPress

  1. Settings → General → Site Language — saves and outputs lang automatically.

  2. If theme hard-codes <html> without language_attributes(), fix the theme.

Shopify

  1. Check theme.liquid — should include {{ locale }} in html tag.

  2. Edit if missing: <html lang="{{ request.locale.iso_code }}">.

Custom HTML

  1. Change <html> to <html lang="en-GB"> (or appropriate code).

Next.js

  1. Set lang on <html> in app/layout.tsx or _document.tsx.

  2. Use locale from i18n routing for multilingual sites.

How to verify the fix

  • Use the most specific code needed (en-GB vs en).

  • Mark foreign phrases inline with lang on a span.

  • Re-check after theme changes.

Common mistakes

  • Wrong language code (eng instead of en).

  • lang on body but not html — must be on html element.

  • Forgetting to update lang when launching in a new locale.

Frequently asked questions

What lang code should I use?

ISO 639-1: en for English, en-GB for British English, fr for French, de for German, etc.

Why does lang matter for screen readers?

It selects the correct voice and pronunciation rules. Wrong lang makes content hard to understand.

Does lang affect SEO?

It helps search engines identify page language for regional results.

What about multilingual sites?

Set lang on html to the primary language; use lang on elements for alternate language sections.

Is lang required by WCAG?

Yes — WCAG 3.1.1 Language of Page (Level A).

Can I have multiple lang values?

One on html for the primary language; additional lang attributes on inline elements as needed.

Does dir="rtl" relate?

For right-to-left languages (Arabic, Hebrew), add dir="rtl" alongside lang.

How do I confirm it worked?

View source shows lang on html; Plexa Trust finding clears on re-scan.

Think you've fixed it?

Run a free scan to verify the issue is resolved. Upgrade to Pro on Plexa Trust for the full audit, monitoring alerts, and score history.

Verify with a free scan

Upgrade to Pro for monitoring