skillfed

iso3166

Self-contained ISO 3166-1 country definitions.

iso3166 v2.1.1 5.5M downloads/30d#2,076 on PyPI149
Permissive license MIT DORMANT released

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 iso3166

uv

uv add iso3166

poetry

poetry add iso3166

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

iso 3166 country codescountry code lookupalpha2 alpha3 numeric conversioncountry name to codeiso country definitions
country-codesiso-standardsreference-data

More Utilities packages