Skip to content
SEO-Wars

On-page

Page language: set the lang attribute

The lang attribute on the html element tells browsers, screen readers and search engines which language the page is in. Set it once in your layout.

Category
On-page
Points available
2 pts
Effort
Quick fix

Why it matters

Screen readers use it to pick the right pronunciation. Browsers use it to offer translation and to apply language-specific typography such as hyphenation.

Search engines mainly detect language from content, but a correct lang removes doubt, especially on short pages.

How we measure it

We read the lang attribute of the <html> element. Any value of at least two characters (like en or tr-TR) passes.

ResultPoints
lang attribute present2
Missing or empty0

How to fix it

  1. Add lang to the <html> tag in your base layout, using a language code like en, tr or de-AT.
  2. On multilingual sites, set it per page to the language of that page.

Copy-paste fixes

HTML
<!doctype html>
<html lang="en">
WordPressheader.php
<html <?php language_attributes(); ?>>
Shopifylayout/theme.liquid
<html class="no-js" lang="{{ request.locale.iso_code }}">
Next.jsapp/layout.tsx
export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>{children}</body>
    </html>
  );
}

Common mistakes

  • Leaving lang="en" from a theme on a site written in Turkish or German.
  • Using a country code instead of a language code (lang="uk" means Ukrainian, not British English).

Test your site now

Put your site against a competitor and see how many of these points you earn, and which fixes pay off first.

Start a duel
← All checksUpdated December 1, 2026
Page language: why it matters and how to fix it · SEO-Wars