Skip to main content
HTML Validation

Bad value X for attribute “lang” on element “y”: Bad script subtag.

About This HTML Issue

A lang value follows the BCP 47 format, where a four-letter subtag placed after the primary language is read as a script subtag from the ISO 15924 registry, and the validator reports "Bad script subtag" when that four-letter piece is not a registered script code.

In es-TRAD, the es part is a valid language subtag for Spanish, but TRAD has four letters, so the parser treats it as a script subtag. ISO 15924 has no Trad script, so the value fails validation. This usually happens when someone invents a code to express a "traditional" or regional variant instead of using a registered subtag.

Valid script subtags are exactly four letters with an initial capital, such as Latn (Latin), Cyrl (Cyrillic), Hans (Simplified Han), and Hant (Traditional Han). Most languages do not need one, because each language has a default script. You add a script subtag only when the text uses a script other than the default, as in zh-Hant for Traditional Chinese.

To fix the value, either use a registered ISO 15924 script subtag or drop the extra subtag and keep just the language code, with an optional region.

Invalid example

<span lang="es-TRAD">Español tradicional</span>

TRAD is read as a script subtag, and it is not a valid ISO 15924 code.

Valid example

<span lang="es">Español</span>

When you genuinely need to mark a script, use a registered ISO 15924 subtag:

<span lang="zh-Hant">繁體中文</span>

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
$7 / 7 days

Pro Trial

Full Pro access. Cancel anytime.

Start Pro Trial →

Join teams across 40+ countries