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

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-x-for-attribute-lang-on-element-y-bad-script-subtag
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

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

```html
<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

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

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

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