UN M49

UN M49 or the Standard Country or Area Codes for Statistical Use (Series M, No. 49) is a standard for area codes used by the United Nations for statistical purposes, developed and maintained by the United Nations Statistics Division. Each area code is a 3-digit number which can refer to a wide variety of geographical and political regions, like a continent and a country. Codes assigned in the system generally do not change when the country or area's name changes (unlike ISO 3166-1 alpha-2 or ISO 3166-1 alpha-3), but instead change when the territorial extent of the country or area changes significantly, although there have been exceptions to this rule.

Some of these codes, those representing countries and territories, were first included as part of the ISO 3166-1 standard in its second edition in 1981, but they have been released by the United Nations Statistics Division since 1970.

Another part of these numeric codes, those representing geographical (continental and sub-continental) supranational regions, was also included in the IANA registry for region subtags (first described in September 2006 in the now obsoleted RFC 4646, but confirmed in its successor RFC 5646, published in September 2009) for use within language tags, as specified in IETF's BCP 47 (where the ISO 3166-1 alpha-2 codes are used as region subtags, instead of UN M.49 codes, for countries and territories).

Code lists
M.49 area codes (as of December 2021)

Private-use codes and reserved codes
Beside the codes standardized above, the numeric codes 900 to 999 are reserved for private-use in ISO 3166-1 (under agreement by the UNSD) and in the UN M.49 standard. They may be used for any other groupings or subdivision of countries, territories and regions.

Some of these private-use codes may be found in some UN statistics reports and databases, for their own specific purpose. They are not portable across databases from third parties (except through private agreement), and may be changed without notice.

Note that the code 000 is reserved and not used for defining any region. It is used in absence of data, or for data in which no region (not even the World as a whole) is applicable. For unknown or unencoded regions, private-use codes should preferably be used. For example, the Unicode Common Locale Data Repository uses 961 for its grouping Outlying Oceania.

Extensions to M.49
Early editions of M.49 used one- or two-digit prefixes to designate economic regions rather than assigning 3-digit codes. These two digit prefixes were designed to be used to easily aggregate data through the use of prefix matching, and regions could be specified collectively by using the 000 code as a base to which the prefix would be added. For example, by prefixing 13 to Algeria's code, 012, to create the five-digit code 13012, Algeria could be identified as being in North Africa (13000), which is itself in Africa (10000).

One-digit suffixes were also permitted, to specify statistics of subdivisions of countries. For example, by suffixing 5 to the code for the United Kingdom to create the four-digit code 8265, Scotland could be represented as a subdivision of the United Kingdom. Additional suffixes could be used to represent the other constituent units of the UK.

Developed and developing regions
The United Nations Statistics Division classifies economic regions into developed and developing regions for statistical convenience. Although this classification was removed from M49 in December 2021, it is still used by the UNSD and various United Nations reports.