BCP 47 Validator

This service lets you validate language tags such as de-CH or en-US according to BCP 47 (formerly RFC 4646) and the IANA Language Subtag Registry. The Language Tag Extensions Registry is not used by this service, but this may change in the future.

Separate multiple tags by comma or whitespace. Do not include quality values such as ;q=0.8. As you type, the background color denotes whether all tags are well-formed and valid, any tag is invalid or any tag is not well-formed.

Language tags:
Output format:

Features

Examples

These language tags are well-formed and valid:

Regular expression

To parse a language tag and verify its well-formedness, this .NET-style regular expression is used:

^
(
  (?'grandfathered'
    (?'irregular'
      en-GB-oed |
      i-ami |
      i-bnn |
      i-default |
      i-enochian |
      i-hak |
      i-klingon |
      i-lux |
      i-mingo |
      i-navajo |
      i-pwn |
      i-tao |
      i-tay |
      i-tsu |
      sgn-BE-FR |
      sgn-BE-NL |
      sgn-CH-DE
    )
    |
    (?'regular'
      art-lojban |
      cel-gaulish |
      no-bok |
      no-nyn |
      zh-guoyu |
      zh-hakka |
      zh-min |
      zh-min-nan |
      zh-xiang
    )
  )
  |
  (
    (
      (
        (?'language'
          [a-z]{2,3}
        )
        (-
          (?'extlang'
            [a-z]{3}
          )
        ){0,3}
      )
      |
      (?'language'
        [a-z]{4}
      )
      |
      (?'language'
        [a-z]{5,8}
      )
    )

    (-(?'script'
      [a-z]{4}
    ))?

    (-(?'region'
      [a-z]{2}
      |
      [0-9]{3}
    ))?

    (-
      (?'variant'
        [a-z0-9]{5,8}
        |
        [0-9][a-z0-9]{3}
      )
    )*
    
    (-
      (?'extensions'
        [a-z0-9-[x]]
        (-
          [a-z0-9]{2,8}
        )+
      )
    )*
    
    (-
      x(- 
        (?'privateuse'
          [a-z0-9]{1,8}
        )
      )+
    )?
  )
  |
  (
    x(- 
      (?'privateuse'
        [a-z0-9]{1,8}
      )
    )+
  )
)
$

Feedback

Don't hesitate to send suggestions and comments to Christoph Schneegans (christoph@schneegans.de).