Technical fix

How to fix a missing HTML lang attribute

One attribute — a lang code on your <html> tag — tells screen readers which voice to use and helps search engines serve your page to the right audience. Missing it is a quiet accessibility fail.

The lang attribute on the opening <html> tag declares the primary language of a page, using an ISO 639-1 code (en, es, fr, de…). It is a small tag with an outsized effect on accessibility.

Screen readers use it to choose the correct pronunciation engine — the difference between an English screen reader reading French text as gibberish and reading it properly. Browsers use it for translation prompts and hyphenation.

Why it matters

A correct lang attribute is a WCAG requirement and directly affects how assistive technology pronounces your content. It also gives search engines an explicit language signal, and it is a prerequisite for getting multi-language hreflang right.

How to tell if this is you

Abby flags “Language” when the <html> tag has no lang attribute, or when the code does not match the actual content language. The fix is adding (or correcting) a single attribute.

Not sure if your site has this?

Run Abby's free scan — it checks this and 25 other on-page, technical, and structured-data signals in about 60 seconds, no signup.

Scan my site free

The fix

Add a lang attribute to your <html> tag: <html lang="en">. Use the correct ISO 639-1 language code for your content.

Before

<html>            <!-- no language declared -->
<head>...</head>

After

<html lang="en">   <!-- ISO 639-1 code for the page language -->
<head>...</head>

Fix it on your platform

WordPress

WordPress sets the lang attribute based on Settings > General > Site Language. Change it there if incorrect.

Shopify

Edit your theme.liquid file and ensure the <html> tag has lang="{{ request.locale.iso_code }}".

Wix

Wix sets the lang attribute based on your site language settings. Change in Settings > Multilingual.

Fix every issue at once.

Abby's free scan finds which of 26 checks your site fails. The $8.99 fix guide turns each one into a copy-ready fix for your exact pages — prioritized, with code — or bundle it with a security fix guide for $19.99.

Get my fix plan

FAQ

What language code should I use?

Use the ISO 639-1 two-letter code for your main content language: en (English), es (Spanish), fr (French), de (German). Add a region when it matters, like en-US or pt-BR.

What's the difference between the lang attribute and hreflang?

The lang attribute declares the language of one page for browsers and screen readers. hreflang links the different language versions of the same page together so Google serves the right one. Use lang on every page; use hreflang only when you have translations.

Can I set lang on individual elements?

Yes. If a page is mostly English but quotes a French phrase, wrap it in an element with lang="fr" so screen readers switch pronunciation for just that part. The <html> lang sets the page default.