iso3166
Self-contained ISO 3166-1 country definitions.
What it is and what it does
iso3166 is a self-contained lookup module for ISO 3166-1 country codes and names. It maintains a static dataset of all recognized countries and territories, allowing you to retrieve country information by alpha-2 code (e.g., 'US'), alpha-3 code (e.g., 'USA'), numeric code (e.g., '840'), or country name. The package provides both direct lookups via a countries object and indexed dictionaries for reverse lookups by name, alpha-2, alpha-3, or numeric code.
The module has no external dependencies and supports Python 3.6 and later. It includes type hints throughout the codebase and is marked Production/Stable. Updates reflect official ISO changes when they occur—for example, recent releases updated country names like Turkey to Türkiye and Macedonia to North Macedonia. The data is frozen at release time, so the package is best suited for applications that can tolerate a lag between official ISO updates and package releases.
Use it for:
- Validate or normalize user-supplied country codes in web forms or APIs.
- Convert between different country code formats (e.g., from user input to a standard format for storage).
- Populate dropdown lists or reference data in applications that need to display all recognized countries.
- Enrich datasets by looking up country names from numeric or alphabetic codes.
- Build geolocation or localization features that need to map country codes to display names.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts between ISO 3166-1 country codes (two-letter, three-letter, and numeric) and country names, with lookup by any code format or iteration over all defined countries.
Yes. The package is lightweight, has no dependencies, and solves a straightforward problem with a stable, well-tested API. Dormant maintenance is not a concern for a data-reference module that changes only when ISO standards change. Use it when you need reliable ISO 3166-1 lookups without external API calls or heavy dependencies.
Install
iso3166 on PyPI
pip
pip install iso3166uv
uv add iso3166poetry
poetry add iso3166Installing iso3166
Before you install
Low friction install with no runtime dependencies. Maintenance is dormant—last release was in July 2022—but the package is marked Production/Stable and the repository remains active, suggesting it is feature-complete rather than abandoned.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects.
Quickstart
pip install iso3166
from iso3166 import countries
country = countries.get('us')
print(country.name, country.alpha2, country.alpha3, country.numeric)
Verify before relying
- Whether the country data is kept current with official ISO 3166-1 updates given the dormant maintenance status.
- Performance characteristics when iterating over all countries or performing bulk lookups.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 1,494 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,547,756/month — #2,076 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: iso3166-2.1.1-py3-none-any.whl
Keywords: iso 3166-1, country codes
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pycountry-convertConverts between ISO country codes (alpha-2,…
permissive · top 15,000 on PyPI
country-converterConverts and matches country names across…
copyleft · top 5,000 on PyPI
country_listProvides ISO 3166-1 country codes and names in…
permissive · top 15,000 on PyPI
isocodesisocodes provides programmatic access to ISO…
permissive · top 15,000 on PyPI
pycountryProvides programmatic access to ISO standard…
copyleft · top 1,000 on PyPI
phone-iso3166Maps international phone numbers and mobile…
permissive · top 15,000 on PyPI
ip3countryLooks up the ISO 3166-1 alpha-2 country code…
permissive · top 5,000 on PyPI
django-countriesProvides a Django model field for storing…
permissive · top 5,000 on PyPI
iso-639Provides a Python interface to ISO 639 language…
agpl · top 15,000 on PyPI
babelfishBabelFish provides Python objects for…
permissive · top 15,000 on PyPI