The BCP 47 Language Tag Lookup & Validator helps you choose and verify the value of an HTML lang attribute on multilingual pages. WCAG 3.1.1 (Language of Page) and 3.1.2 (Language of Parts) both depend on a correctly formed language tag, and a malformed tag silently breaks screen-reader pronunciation and hreflang targeting.
How it works
- Parse into subtags. Your tag is split on hyphens. The first subtag must be a 2 to 3 letter primary language; an optional 4-letter script subtag and an optional 2-letter or 3-digit region subtag may follow, then any variant or extension subtags.
- Validate each subtag. Each position is checked against the BCP 47 structure rules. Subtags that match the structure but are not in the bundled registry subset are flagged as warnings rather than errors, since the full IANA registry is larger.
- Canonicalise. A well-formed tag is rebuilt in canonical casing — language lowercase, script Titlecase, region uppercase — for example
zh-Hant-HK. The tool shows the exactlang="…"string to paste. - Search. A second box searches the bundled registry by subtag code or name so you can find, say, the code for “Georgian” or “Cyrillic”.
Tips and notes
- Set
langon the roothtmlelement for the page default, and addlangon any element whose content is in a different language to satisfy 3.1.2. - Omit the region unless it is meaningful —
enis usually better than guessingen-USwhen content is region-neutral. - Use the same canonical tags for your
hreflanglink annotations so search engines and assistive technology agree on the language.