Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Missing lang attribute on html: how to find and fix it

PRF-320Low impactOther toolBy FunnelGuardPublished Updated
On this page

What this issue is

Every web page starts with an <html> tag. The lang attribute on that tag holds a language code, such as en for English, fr for French or de for German. When it is missing, the page does not declare its language.

Assistive technology uses this value. A screen reader picks the voice and pronunciation rules from it. Browsers use it for spell checking, hyphenation and quote styles, and translation tools use it to decide whether to offer a translation.

Missing vs correcthtml
<!-- Missing -->
<html>

<!-- Correct -->
<html lang="en">

<!-- Regional variant, if you need it -->
<html lang="en-GB">

Why it costs you leads or sales

The direct impact is low, but it is real. A screen reader user may hear your forms and buttons read with the wrong accent or voice, which makes a checkout or lead form hard to follow. Some will leave rather than struggle.

Browser translation prompts can also misfire when the language is unclear. Visitors may be offered a translation of a page that is already in their language, or none when they need it. It is also a basic accessibility failure that audits and procurement checks often flag, which can matter if you sell to larger organisations.

Who is affectedExample numbers
Who is affected (example)Typical visitors: 0 % of visitors; Screen reader users: 3 % of visitors; Translation tool users: 5 % of visitors024035Typical visitorsScreen reader usersTranslation tool users% of visitors

Example: a small share of visitors rely on screen readers or translation, so the impact is low but the fix is nearly free.

How to check if your site has it

Check the lang attribute
  1. View the page source

    Open your page, right-click and choose View page source (or press Ctrl+U / Cmd+Option+U). Look at the first few lines for the <html> tag.

  2. Check in DevTools

    Open the console and run document.documentElement.lang. An empty string means the attribute is missing or empty.

  3. Run an accessibility audit

    Lighthouse (in Chrome DevTools, Accessibility category) reports 'html element does not have a lang attribute'. Browser extensions such as axe DevTools report it too.

  4. Check key templates

    Test the home page, a landing page, the checkout and any thank-you page. Different templates can have different html tags.

Console checkjavascript
document.documentElement.lang || 'MISSING'

How to fix it

Use the correct code for the main language of the page. Use two letters such as en, or add a region such as en-US or pt-BR if it matters. The steps depend on your platform.

Add lang by platform
  1. Set the site language

    Go to Settings > General > Site Language and choose your language. Themes that call language_attributes() will then output lang automatically.

  2. Check header.php

    In your theme's header.php, the tag should read <html <?php language_attributes(); ?>>. Use a child theme if you edit it.

What changes

No lang attribute

  • Screen reader guesses the voice
  • Translation prompts can misfire
  • Fails WCAG 3.1.1

lang="en" set

  • Correct voice and pronunciation
  • Translation tools know the source language
  • Passes automated lang checks

How to confirm it's fixed

Confirm the fix
  • View source shows <html lang="..."> with a valid code
  • document.documentElement.lang returns your language code
  • Lighthouse accessibility audit no longer reports the lang issue
  • The code matches the actual page language
  • Key templates (home, landing, checkout, thank-you) were all checked
  • Cache cleared so you see the live version

How to prevent it happening again

Set lang once in the shared layout, not page by page. When you switch themes, rebuild a template or add a landing page builder, check the rendered html tag again. Add an accessibility check, such as Lighthouse or axe, to your release routine so a missing value is caught before launch.

How FunnelGuard handles this

This issue is outside what FunnelGuard checks. FunnelGuard monitors your funnels by running real journeys, tracking hits and test lead delivery. It does not audit page markup for accessibility. For the lang attribute, use an accessibility testing tool such as Lighthouse, axe DevTools or WAVE, or an HTML validator.

Questions people ask

What does the lang attribute on the html tag do?

It declares the main language of the page, such as en or fr. Screen readers use it to choose the right voice and pronunciation, and browsers use it for spell checking, hyphenation and translation prompts.

Why is my html lang attribute missing?

Usually the theme or template omits it, or a custom layout or page builder outputs a bare <html> tag. On WordPress, a theme not calling language_attributes() is a common cause.

How do I add the lang attribute to my html tag?

Edit the shared layout so the tag reads <html lang="en">, using your language code. On platforms like WordPress, Shopify, Webflow and Squarespace, you can often set it through language settings instead.

Is a missing lang attribute a WCAG failure?

Yes. It fails WCAG Success Criterion 3.1.1, Language of Page, which is Level A. Automated tools like Lighthouse and axe report it.

Does a missing lang attribute hurt SEO?

It is not a major ranking factor, as search engines detect language from content. It still helps clarity and accessibility, so it is worth fixing.

What language code should I use?

Use a BCP 47 code: a two-letter language code like en, de or es, optionally with a region such as en-GB or pt-BR. Match it to the main language of the visible page content.

Can FunnelGuard detect a missing lang attribute?

No. This falls outside FunnelGuard's checks, which cover funnel journeys, tracking hits and lead delivery. Use an accessibility tool such as Lighthouse, axe or WAVE for this.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.