ISO 3166-1 Alpha-2 Country Code Validator
Check whether text is a valid ISO 3166-1 alpha-2 country code as you type it, right in your browser, without sending it anywhere.
Input
Output
No value
Guide
What is an ISO 3166-1 alpha-2 country code?
ISO 3166-1 alpha-2 codes are the two-letter codes for countries and territories: DE for Germany, JP for Japan, BR for Brazil, GB for the United Kingdom. They're the most widely used country codes, found in address and shipping forms, payment systems, flag emoji, locale codes such as en-GB and most country web addresses. The ISO 3166 Maintenance Agency keeps the list, adding codes for new countries and retiring old ones.
Developers, online shops and data analysts check country codes when they import addresses, fill in a country field, set up shipping or tax rules, or clean up a spreadsheet where someone typed UK for the United Kingdom.
Tool description
Type or paste a code into the ISO 3166-1 alpha-2 country code field, and the result shows as you type: "ISO 3166-1 alpha-2 country code is valid" or "ISO 3166-1 alpha-2 country code is not valid". Spaces and line breaks around the code are ignored, and small letters count as capitals, so de passes too. The page has no settings.
What passes and what fails
- Codes of countries, and of territories that have one of their own, such as
PRfor Puerto Rico,BMfor Bermuda andAQfor Antarctica UKfails: the United Kingdom's code isGB, andUKis only reserved so that nobody else gets itEUfor the European Union fails, and so doesXK, which some organizations use for Kosovo: both are outside the list of assigned codes- Retired codes fail, such as
ANfor the Netherlands Antilles andTP, East Timor's old code (nowTL) - Codes left for private use, such as
AA,ZZand those starting with X, fail - Three letters such as
DEUfail: check those with the ISO 3166-1 Alpha-3 Country Code Validator
Good to know
- A code that passes is in the copy of the ISO list that comes with validator.js. The page can't tell whether it's the country you meant:
AT(Austria) typed forAU(Australia) passes too. - For test data, the Random Country Code Generator makes lists of two-letter codes.
Features
- Checks two-letter ISO 3166-1 codes against the list
- Capital or small letters
- Rejects retired, reserved and private-use codes
- Results as you type, with no button to press
- Runs in your browser, so nothing you type is sent anywhere