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 PR for Puerto Rico, BM for Bermuda and AQ for Antarctica
  • UK fails: the United Kingdom's code is GB, and UK is only reserved so that nobody else gets it
  • EU for the European Union fails, and so does XK, which some organizations use for Kosovo: both are outside the list of assigned codes
  • Retired codes fail, such as AN for the Netherlands Antilles and TP, East Timor's old code (now TL)
  • Codes left for private use, such as AA, ZZ and those starting with X, fail
  • Three letters such as DEU fail: 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 for AU (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