countries-list, country-data, country-list, and i18n-iso-countries are npm packages that provide country-related information such as names, ISO codes, currencies, calling codes, and more. These utilities are commonly used in internationalization (i18n), form validation, dropdowns, or geolocation features. While they share overlapping goals, they differ significantly in data structure, completeness, update frequency, bundle size, and API design. Note that i18n-iso-countries appears twice in the input list but is a single package.
When building applications that handle international users—such as e-commerce checkouts, user profiles, or shipping forms—you often need reliable country data. Five packages are frequently considered: countries-list, country-data, country-list, and i18n-iso-countries (listed twice in the query, but it's one package). Let’s compare them across key dimensions.
countries-listimport countries from 'countries-list';
console.log(countries.US);
// { name: "United States", native: "United States", phone: "1", ... }
country-dataname, alpha2, alpha3import { countries } from 'country-data';
console.log(countries.all[0]); // { name: "Afghanistan", alpha2: "AF", alpha3: "AFG" }
country-list{ [code]: name } mappingimport countries from 'country-list';
countries.getCode('United States'); // 'US'
i18n-iso-countriesregisterLocale(require('i18n-iso-countries/langs/en.json'))isValid(alpha2), getAlpha2Code(name, lang)import countries from 'i18n-iso-countries';
import en from 'i18n-iso-countries/langs/en.json';
countries.registerLocale(en);
countries.getName('US', 'en'); // "United States"
| Package | Last Published | GitHub Stars | Actively Maintained? |
|---|---|---|---|
countries-list | 2024 | ~2.5k | ✅ Yes |
country-data | 2017 | ~1.2k | ❌ No |
country-list | 2023 | ~800 | ⚠️ Minimal updates |
i18n-iso-countries | 2024 | ~2.8k | ✅ Yes |
⚠️ Avoid
country-datafor production apps due to outdated geopolitical data.
countries-list: ~50 KB (but supports tree-shaking — you can import only what you need)country-data: ~15 KBcountry-list: ~4 KBi18n-iso-countries: ~10 KB core + ~5 KB per language file (lazy-loadable)For performance-sensitive apps (e.g., mobile web),
country-listor selective imports fromcountries-listare optimal.
Only i18n-iso-countries offers true multilingual support out of the box. The others provide English-only names.
i18n-iso-countriescountries-listcountries-list: Pure data — no methods. Flexible for any use case.i18n-iso-countries: Rich API (getNames(), isValid(), toAlpha3()) — great for validation.country-list: Simple getter functions — ideal for basic UI dropdowns.country-data: Read-only array — requires manual indexing.| Use Case | Recommended Package |
|---|---|
| Modern React app with country dropdown + emoji flags | countries-list |
| Multilingual enterprise application | i18n-iso-countries |
| Lightweight form with country selector | country-list |
| Legacy project (avoid new usage) | ❌ country-data |
countries-list strikes the best balance: up-to-date, rich data, small footprint, and zero dependencies.i18n-iso-countries is the gold standard despite its steeper setup.country-data unless maintaining old code.country-list only when every byte counts and you need nothing beyond name ↔ code mapping.All four serve valid niches—but choose based on your app’s scale, language needs, and maintenance expectations.
Choose i18n-iso-countries if your project requires strict ISO 3166 compliance, multilingual country names (via locale registration), and validation utilities (e.g., checking if a code is valid). It’s widely used in enterprise i18n workflows and integrates well with libraries like i18next. However, it requires manual locale loading and has a slightly more verbose API.
Choose country-list if you only need simple mappings between country names and ISO 3166-1 alpha-2 codes (e.g., { 'US': 'United States' }). It’s extremely lightweight (<5KB) but lacks additional fields like currencies, phone codes, or multilingual support. Best for basic select inputs where minimal bundle impact is critical.
Choose country-data if you prefer a minimalistic approach with basic country info (name, alpha-2/3 codes) and don’t require extensive metadata like currencies or languages. However, note that this package hasn’t been updated since 2017 and may contain outdated geopolitical data.
Choose countries-list if you need a lightweight (~50KB minified), modern, and well-maintained package with comprehensive country data including names, native names, phone codes, currencies, emoji flags, and continents. It supports tree-shaking and provides data in a clean, consistent JSON format. Ideal for React/Vue apps requiring international dropdowns or country metadata without heavy dependencies.
i18n for ISO 3166-1 country codes. We support Alpha-2, Alpha-3 and Numeric codes from 'Wikipedia: Officially assigned code elements'
Install it using npm: npm install i18n-iso-countries
var countries = require("i18n-iso-countries");
If you use i18n-iso-countries with Node.js, you are done. If you use the package in a browser environment, you have to register the languages you want to use to minimize the file size.
// Support french & english languages.
countries.registerLocale(require("i18n-iso-countries/langs/en.json"));
countries.registerLocale(require("i18n-iso-countries/langs/fr.json"));
var countries = require("i18n-iso-countries");
// in a browser environment: countries.registerLocale(require("i18n-iso-countries/langs/en.json"));
console.log("US (Alpha-2) => " + countries.getName("US", "en")); // United States of America
console.log("US (Alpha-2) => " + countries.getName("US", "de")); // Vereinigte Staaten von Amerika
console.log("USA (Alpha-3) => " + countries.getName("USA", "en")); // United States of America
console.log("USA (Numeric) => " + countries.getName("840", "en")); // United States of America
// Some countries have alias/short names defined. `select` is used to control which
// name will be returned.
console.log("GB (select: official) => " + countries.getName("GB", "en", {select: "official"})); // United Kingdom
console.log("GB (select: alias) => " + countries.getName("GB", "en", {select: "alias"})); // UK
console.log("GB (select: all) => " + countries.getName("GB", "en", {select: "all"})); // ["United Kingdom", "UK", "Great Britain"]
// Countries without an alias will always return the offical name
console.log("LT (select: official) => " + countries.getName("LT", "en", {select: "official"})); // Lithuania
console.log("LT (select: alias) => " + countries.getName("LT", "en", {select: "alias"})); // Lithuania
console.log("LT (select: all) => " + countries.getName("LT", "en", {select: "all"})); // ["Lithuania"]
var countries = require("i18n-iso-countries");
// in a browser environment: countries.registerLocale(require("i18n-iso-countries/langs/en.json"));
console.log(countries.getNames("en", {select: "official"})); // { 'AF': 'Afghanistan', 'AL': 'Albania', [...], 'ZM': 'Zambia', 'ZW': 'Zimbabwe' }
In case you want to add new language, please refer ISO 639-1 table.
af: Afrikaansam: Amharicar: Arabicaz: Azerbaijanibe: Belorussianbg: Bulgarianbn: Bengalibr: Bretonbs: Bosnianca: Catalancs: Czechcy: Cymraegda: Danishde: Germandv: Dhivehien: Englishes: Spanishet: Estonianeu: Basquefa: Persianfi: Finnishfr: Frenchga: Irishgl: Galicianel: Greekha: Hausahe: Hebrewhi: Hindihr: Croatianhu: Hungarianhy: Armenianis: Icelandicit: Italianid: Indonesianja: Japaneseka: Georgiankk: Kazakhkm: Khmerko: Koreanku: Kurdishky: Kyrgyzlt: Lithuanianlv: Latvianmk: Macedonianml: Malayalammn: Mongolianmr: Marathims: Malaymt: Maltesenb: Norwegian Bokmålnl: Dutchnn: Norwegian Nynorskno: Norwegianpl: Polishps: Pashtopt: Portuguesero: Romanianru: Russiansd: Sindhisk: Slovaksl: Sloveneso: Somalisq: Albaniansr: Serbiansv: Swedishsw: Swahilita: Tamiltg: Tajikth: Thaitk: Turkmentr: Turkishtt: Tatarug: Uyghuruk: Ukrainianur: Urduuz: Uzbekzh: Chinesevi: Vietnamesevar countries = require("i18n-iso-countries");
console.log("List of supported languages => " + countries.getSupportedLanguages());
// List of supported languages => ["cy", "dv", "sw", "eu", "af", "am", ...]
var countries = require("i18n-iso-countries");
// in a browser environment: countries.registerLocale(require("i18n-iso-countries/langs/en.json"));
console.log("United States of America => " + countries.getAlpha2Code("United States of America", "en"));
// United States of America => US
console.log("United States of America => " + countries.getAlpha3Code("United States of America", "en"));
// United States of America => USA
var countries = require("i18n-iso-countries");
// in a browser environment: countries.registerLocale(require("i18n-iso-countries/langs/en.json"));
console.log("USA (Alpha-3) => " + countries.alpha3ToAlpha2("USA") + " (Alpha-2)");
// USA (Alpha-3) => US (Alpha-2)
var countries = require("i18n-iso-countries");
// in a browser environment: countries.registerLocale(require("i18n-iso-countries/langs/en.json"));
console.log("840 (Numeric) => " + countries.numericToAlpha2("840") + " (Alpha-2)");
// 840 (Numeric) => US (Alpha-2)
var countries = require("i18n-iso-countries");
// in a browser environment: countries.registerLocale(require("i18n-iso-countries/langs/en.json"));
console.log("DE (Alpha-2) => " + countries.alpha2ToAlpha3("DE") + " (Alpha-3)");
// DE (Alpha-2) => DEU (Alpha-3)
var countries = require("i18n-iso-countries");
// in a browser environment: countries.registerLocale(require("i18n-iso-countries/langs/en.json"));
console.log("840 (Numeric) => " + countries.numericToAlpha3("840") + " (Alpha-3)");
// 840 (Numeric) => USA (Alpha-3)
var countries = require("i18n-iso-countries");
// in a browser environment: countries.registerLocale(require("i18n-iso-countries/langs/en.json"));
console.log(countries.alpha3ToNumeric("SWE"));
// 752
var countries = require("i18n-iso-countries");
// in a browser environment: countries.registerLocale(require("i18n-iso-countries/langs/en.json"));
console.log(countries.alpha2ToNumeric("SE"));
// 752
var countries = require("i18n-iso-countries");
// in a browser environment: countries.registerLocale(require("i18n-iso-countries/langs/en.json"));
console.log(countries.getAlpha2Codes());
// { 'AF': 'AFG', 'AX': 'ALA', [...], 'ZM': 'ZMB', 'ZW': 'ZWE' }
var countries = require("i18n-iso-countries");
// in a browser environment: countries.registerLocale(require("i18n-iso-countries/langs/en.json"));
console.log(countries.getAlpha3Codes());
// { 'AFG': 'AF', 'ALA': 'AX', [...], 'ZMB': 'ZM', 'ZWE': 'ZW' }
var countries = require("i18n-iso-countries");
// in a browser environment: countries.registerLocale(require("i18n-iso-countries/langs/en.json"));
console.log(countries.getNumericCodes());
// { '004': 'AF', '008': 'AL', [...], '887': 'YE', '894': 'ZM' }
var countries = require("i18n-iso-countries");
// in a browser environment: countries.registerLocale(require("i18n-iso-countries/langs/en.json"));
console.log(
countries.isValid("US"),
countries.isValid("USA"),
countries.isValid("XX")
);
// true, true, false
To add a language:
npm run lint and npm testYou can check codes here: https://www.iso.org/obp/ui/#home