<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet" /> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />

ISO 3166 Numeric Codes: A Practical Guide for Software

October 15, 2026 2 minCountryDataAPI
ISO 3166 Numeric Codes: A Practical Guide for Software

ISO 3166-1 numeric codes provide a script-independent way to identify countries and other areas covered by the standard. For developers, understanding their format and how to preserve it in stored data can help keep country references consistent across software systems.

ISO 3166-1 numeric codes provide a script-independent way to identify countries and other areas covered by the standard. For developers, understanding their format and how to preserve it in stored data can help keep country references consistent across software systems.

What are ISO 3166 numeric codes?

ISO 3166-1 numeric codes are three-digit codes used to represent countries, dependent territories, and special areas of geographical interest. The numeric codes are identical to those developed and maintained by the United Nations Statistics Division as part of UN M.49 ISO 3166-1 numeric - Wikipedia.

ISO 3166 was first issued in 1974, and the underlying numeric values had been published by the United Nations since 1970. The numeric codes were integrated into the second edition of ISO 3166 in 1981 ISO 3166-1 numeric - Wikipedia. Developers working with country reference data can use these codes as part of a standardized country-data model.

How do numeric codes relate to alphabetic country codes?

ISO 3166-1 includes numeric codes as well as alphabetic alpha-2 and alpha-3 codes. Numeric codes do not rely on letters from a particular writing system, while the alphabetic codes use the Latin alphabet ISO 3166-1 numeric - Wikipedia.

Numeric codes are not based on country names, which can make them useful in datasets that need a consistent numeric reference. As with any country-code field, interpret a code in the context of the relevant dataset and its records.

How are country numeric codes used in databases?

When storing ISO 3166 numeric codes, use a text representation if you need to preserve leading zeros. For example, Afghanistan is represented as 004, Albania as 008, and the United States as 840 ISO 3166-1 numeric - Wikipedia. An integer representation cannot retain the leading zeros in values such as 004 and 008. A database schema example is available in the GitHub repository.

A country-data table may include numeric codes alongside alpha-2 or alpha-3 codes and country names. For guidance on integrating location data into forms, including address autocomplete and validation, see the API documentation.

Where can I find ISO 3166 country data?

For country-code references, consult the published ISO country codes list and the other reference materials cited in this guide. You can also explore country reference data for administrative data used in location integrations.

To review the available service plans, visit plans and pricing.

Frequently asked questions

What are ISO 3166 numeric codes?

ISO 3166-1 numeric codes are three-digit codes used for countries, dependent territories, and special areas of geographical interest. They are identical to the numeric values in UN M.49.

How can I preserve leading zeros in numeric country codes?

Store the code as text when leading zeros need to be preserved. For example, Afghanistan is represented as 004 and Albania as 008.

What are ISO 3166-1 alpha-2 codes?

Alpha-2 codes are the two-letter alphabetic codes in ISO 3166-1. The standard also includes alpha-3 codes and numeric codes.

Sources

This article was produced with the help of AI and reviewed for accuracy against the cited sources.