Country Code ISO 3166 Alpha-2 Validator
Validate whether a normalized two-letter value is a currently assigned ISO 3166-1 alpha-2 country code. Reserved and user-assigned letter pairs are not accepted.
Description
Validate normalized values against the 249 assigned ISO 3166-1 alpha-2 country codes rather than letter-count formatting alone.
Validate whether a normalized two-letter value is a currently assigned ISO 3166-1 alpha-2 country code. Reserved and user-assigned letter pairs are not accepted.
When to use Country Code ISO 3166 Alpha-2 Validator
- Validate normalized values against the 249 assigned ISO 3166-1 alpha-2 country codes rather than letter-count formatting alone.
- Apply the same explicit rule consistently during ingest, quality control, reporting, or preservation planning.
- Expose records that need human review without silently rewriting the source data.
How the calculation works
Reserved, exceptional, and user-assigned pairs such as EU or XK are not the same as officially assigned ISO 3166-1 country codes.1
valid = uppercase(trim(code)) ∈ assigned ISO 3166-1 alpha-2 set Interpreting the result
Reserved, exceptional, and user-assigned pairs such as EU or XK are not the same as officially assigned ISO 3166-1 country codes.
Assumptions and limitations
- ISO assignments can change; applications needing live maintenance notices should refresh their code table from the ISO 3166 Maintenance Agency.
- Preserve the original value and record the rule version when using this result in an archival workflow.
References
-
ISO 3166 Country Codes — International Organization for Standardization