---
id: "countrycode_alpha2"
kind: "pattern"
status: "stable"
is_pii: false
categories: ["geo"]
langs: ["common"]
quality: 80
url: "http://registry.apicrafter.io/datatype/countrycode_alpha2"
---

# ISO 3166-1 Alpha2 country code (`countrycode_alpha2`)

ISO 3166-1 alpha-2 codes are two-letter country codes defined in ISO 3166-1, part of the ISO 3166 standard published by the International Organization for Standardization (ISO), to represent countries, dependent territories, and special areas of geographical interest.

- Pattern of: `country`
- Personal data (PII): no
- Categories: Geographic identifiers (geo)
- Countries: global
- Languages: Common to most languages (common)
- Classification: categorical

## Detection

Regular expression (Python `re`):

```
[A-Z]{2}
```

## Examples

- `WF` — Wallis and Futuna
- `AI` — Anguilla

## Mappings

- autotype: `countrycode`
- bioregistry: `iso.3166-2`
- fta: `COUNTRY.ISO-3166-2`
- wikidata: `P297`

## Metacrafter rules

2 rules: 0 match the field name, 2 match values.

- `iso3166-alpha2` (data, `common/intcodes.yaml`)
- `iso3166-alpha2imprecise` (data, `common/intcodes.yaml`)

## Supported by tools

- `autotype`
- `csvdetective`
- `fta`
- `greatexpectations`
- `ibmknowledgecatalog`
- `metacrafter`
- `metacrafterpro`
- `tableau`
- `talend`
- `woodwork`

## Sources

- wikipedia: <https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2>
- wikidata: <https://www.wikidata.org/wiki/Property:P297>

## Quality

Score 80/100. Missing: anchored regexp, negative example, translation.

JSON: <http://registry.apicrafter.io/api/v1/datatypes/countrycode_alpha2.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/any/geo/countrycode_alpha2.yaml>
