i18n-iso-countries vs countries-list vs countries-and-timezones vs country-data vs country-list vs iso-3166-1
Country Data Libraries for Frontend Applications
i18n-iso-countriescountries-listcountries-and-timezonescountry-datacountry-listiso-3166-1Similar Packages:

Country Data Libraries for Frontend Applications

These six npm packages provide country-related data for web applications, including ISO codes, country names, timezones, currencies, and phone codes. Each takes a different approach to data structure, localization support, and API design. Some focus on minimal ISO code mappings, while others offer comprehensive country information with translations. Understanding their differences helps developers choose the right tool for forms, internationalization, timezone handling, and geographic data display in frontend projects.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
i18n-iso-countries1,452,053893624 kB55a year agoMIT
countries-list496,0041,308274 kB9a month agoMIT
countries-and-timezones0272316 kB15a year agoMIT
country-data0518-359 years agoMIT
country-list028216.9 kB18 months agoMIT
iso-3166-105938.1 kB4-MIT

Country Data Libraries: Technical Comparison for Frontend Developers

When building forms, internationalization systems, or global user interfaces, you'll need reliable country data. The six packages covered here β€” countries-and-timezones, countries-list, country-data, country-list, i18n-iso-countries, and iso-3166-1 β€” all serve this purpose but with different trade-offs in data coverage, API design, and maintenance status. Let's examine how they handle real-world scenarios.

πŸ“¦ Data Coverage: What Information Each Package Provides

The first question when choosing a country library is simple: what data do you actually need?

countries-and-timezones combines country information with timezone data in one package.

import c from 'countries-and-timezones';

// Get country by code
const country = c.getCountry('US');
// { name: 'United States', code: 'US', timezones: ['America/New_York', ...] }

// Get all timezones for a country
const timezones = c.getCountriesTimezones('US');
// ['America/New_York', 'America/Chicago', 'America/Denver', ...]

countries-list provides country names, ISO codes, currencies, and phone codes.

import { countries } from 'countries-list';

// Access country by code
const country = countries.US;
// { name: 'United States', iso2: 'US', iso3: 'USA', currency: 'USD', phoneCode: '+1' }

// Iterate over all countries
Object.values(countries).forEach(country => {
  console.log(country.name, country.iso2);
});

country-data once offered comprehensive data including flags and regions, but is now unmaintained.

import countries from 'country-data';

// Get country by code
const country = countries.countries.US;
// { name: 'United States', alpha2: 'US', alpha3: 'USA', currency: 'USD' }

// Get currency info
const currency = countries.currencies.USD;
// { symbol: '$', name: 'US Dollar' }

country-list keeps things minimal with just codes and names.

import { getCode, getName, getNames } from 'country-list';

// Convert name to code
const code = getCode('United States');
// 'US'

// Convert code to name
const name = getName('US');
// 'United States'

// Get all countries as array
const allCountries = getNames();
// ['Afghanistan', 'Albania', ...]

i18n-iso-countries focuses on translations across many languages.

import countries from 'i18n-iso-countries';
import enLocale from 'i18n-iso-countries/langs/en.json';

// Register locale
countries.registerLocale(enLocale);

// Get country name in registered language
const name = countries.getName('US', 'en');
// 'United States'

// Get all country codes
const codes = countries.getCodes();
// ['AF', 'AL', 'DZ', ...]

iso-3166-1 provides strict ISO 3166-1 standard data only.

import { alpha2, alpha3, numeric } from 'iso-3166-1';

// Get country by alpha-2 code
const country = alpha2.get('US');
// { alpha2: 'US', alpha3: 'USA', numeric: '840', name: 'United States' }

// Get country by alpha-3 code
const country3 = alpha3.get('USA');
// { alpha2: 'US', alpha3: 'USA', numeric: '840', name: 'United States' }

🌍 Localization: Multi-Language Support Compared

For global applications, displaying country names in the user's language is often required.

countries-and-timezones has limited built-in translation support.

import c from 'countries-and-timezones';

// Primary names only - no built-in locale switching
const country = c.getCountry('DE');
// { name: 'Germany', ... } - always in English

countries-list provides names in English only.

import { countries } from 'countries-list';

// No locale parameter - names are fixed
const country = countries.FR;
// { name: 'France', ... } - English only

country-data includes some translations but is inconsistent.

import countries from 'country-data';

// Some translation support via translations property
const country = countries.countries.FR;
// { name: 'France', translations: { de: 'Frankreich', ... } }

country-list does not support translations.

import { getName } from 'country-list';

// Always returns English names
const name = getName('JP');
// 'Japan' - no locale option available

i18n-iso-countries excels with 100+ language packs available.

import countries from 'i18n-iso-countries';
import deLocale from 'i18n-iso-countries/langs/de.json';
import jaLocale from 'i18n-iso-countries/langs/ja.json';

countries.registerLocale(deLocale);
countries.registerLocale(jaLocale);

// Get name in different languages
const deName = countries.getName('DE', 'de');
// 'Deutschland'

const jaName = countries.getName('DE', 'ja');
// 'ドむツ'

iso-3166-1 provides standard names without translation focus.

import { alpha2 } from 'iso-3166-1';

// Standard ISO names only
const country = alpha2.get('FR');
// { name: 'France', ... } - no locale switching

πŸ”§ API Design: How Developers Interact With Each Package

The way you access data affects code readability and maintenance.

countries-and-timezones uses a function-based API with getter methods.

import c from 'countries-and-timezones';

// Function calls for all operations
const country = c.getCountry('CA');
const allCountries = c.getCountries();
const timezones = c.getTimezones();
const byTimezone = c.getCountriesForTimezone('America/Toronto');

countries-list exports a plain object for direct property access.

import { countries } from 'countries-list';

// Direct object property access
const us = countries.US;
const uk = countries.GB;

// Iterate easily
for (const code in countries) {
  console.log(code, countries[code].name);
}

country-data uses nested objects with multiple data categories.

import countries from 'country-data';

// Nested structure for different data types
const country = countries.countries.US;
const currency = countries.currencies.USD;
const callingCode = countries.callingCodes['1'];

country-list provides utility functions for conversion.

import { getCode, getName, getNames, toAlpha3Code } from 'country-list';

// Conversion-focused API
const code = getCode('Canada');
const alpha3 = toAlpha3Code(code);
const all = getNames();

i18n-iso-countries requires locale registration before use.

import countries from 'i18n-iso-countries';
import enLocale from 'i18n-iso-countries/langs/en.json';

// Must register locale first
countries.registerLocale(enLocale);

// Then use translation methods
const name = countries.getName('BR', 'en');
const codes = countries.getCodes();
const allNames = countries.getNames('en');

iso-3166-1 separates data by ISO code type.

import { alpha2, alpha3, numeric, all } from 'iso-3166-1';

// Separate modules for each code type
const byAlpha2 = alpha2.get('MX');
const byAlpha3 = alpha3.get('MEX');
const byNumeric = numeric.get('484');
const allCountries = all.filter(c => c.alpha2);

⚠️ Maintenance Status: Which Packages Are Still Active

Package maintenance affects long-term project stability.

countries-and-timezones receives regular updates with timezone database refreshes.

// Actively maintained - timezone data stays current
import c from 'countries-and-timezones';

// Safe for production use
const country = c.getCountry('UA');
// Data reflects current geopolitical boundaries

countries-list has stable maintenance with occasional updates.

// Stable package - suitable for production
import { countries } from 'countries-list';

// Reliable for long-term projects
const country = countries.IN;

country-data is no longer actively maintained β€” avoid for new projects.

// ⚠️ DEPRECATED - Do not use in new projects
import countries from 'country-data';

// Consider alternatives like i18n-iso-countries instead
// Last significant update was several years ago

country-list remains stable with minimal changes needed.

// Stable and lightweight
import { getName } from 'country-list';

// Good for simple use cases that won't need frequent updates
const name = getName('AU');

i18n-iso-countries has active maintenance with regular locale updates.

// Actively maintained with community contributions
import countries from 'i18n-iso-countries';

// Safe choice for internationalized applications
const name = countries.getName('CN', 'zh');

iso-3166-1 follows ISO standard updates when published.

// Maintained to match ISO 3166-1 standard revisions
import { alpha2 } from 'iso-3166-1';

// Updates when ISO publishes changes
const country = alpha2.get('SS');

🎯 Real-World Use Cases: Which Package Fits Your Scenario

Scenario 1: Global E-Commerce Checkout Form

You need country selection with currency display in the user's language.

// βœ… Best choice: i18n-iso-countries
import countries from 'i18n-iso-countries';
import { countries as countryData } from 'countries-list';

countries.registerLocale(enLocale);
countries.registerLocale(esLocale);

function renderCountrySelect(userLocale) {
  return countries.getCodes().map(code => ({
    code,
    name: countries.getName(code, userLocale),
    currency: countryData[code]?.currency
  }));
}

Scenario 2: Meeting Scheduler with Timezone Selection

You need to show timezones available in each country.

// βœ… Best choice: countries-and-timezones
import c from 'countries-and-timezones';

function getTimezonesForCountry(countryCode) {
  return c.getCountriesTimezones(countryCode);
}

function getCountryForTimezone(timezone) {
  return c.getCountriesForTimezone(timezone);
}

// Render timezone dropdown based on selected country
const usTimezones = getTimezonesForCountry('US');
// ['America/New_York', 'America/Chicago', ...]

Scenario 3: Simple Country Dropdown

You need a basic country selector with minimal dependencies.

// βœ… Best choice: country-list
import { getNames, getCode } from 'country-list';

function renderSimpleSelect() {
  return getNames().map(name => ({
    label: name,
    value: getCode(name)
  }));
}

// Or use countries-list for more data
import { countries } from 'countries-list';

function renderWithCodes() {
  return Object.entries(countries).map(([code, data]) => ({
    label: data.name,
    value: code,
    phoneCode: data.phoneCode
  }));
}

Scenario 4: Data Validation and Normalization

You need to validate and convert country codes in backend services.

// βœ… Best choice: iso-3166-1
import { alpha2, alpha3 } from 'iso-3166-1';

function validateAndNormalize(input) {
  // Try alpha-2 first
  let country = alpha2.get(input.toUpperCase());
  
  // Fall back to alpha-3
  if (!country) {
    country = alpha3.get(input.toUpperCase());
  }
  
  return country ? country.alpha2 : null;
}

// Returns standardized alpha-2 code or null
const code = validateAndNormalize('USA');
// 'US'

πŸ“Š Feature Comparison Summary

Featurecountries-and-timezonescountries-listcountry-datacountry-listi18n-iso-countriesiso-3166-1
Timezone Dataβœ… Yes❌ No❌ No❌ No❌ No❌ No
Currency Info❌ Noβœ… Yesβœ… Yes❌ No❌ No❌ No
Phone Codes❌ Noβœ… Yesβœ… Yes❌ No❌ No❌ No
Translations❌ No❌ No⚠️ Limited❌ Noβœ… 100+ Languages❌ No
ISO Complianceβœ… Yesβœ… Yesβœ… Yesβœ… Yesβœ… Yesβœ… Strict
Maintenanceβœ… Activeβœ… Stable❌ Deprecatedβœ… Stableβœ… Activeβœ… Active
Bundle SizeMediumSmallLargeTinyMedium+Small
TypeScriptβœ… Yesβœ… Yes❌ Noβœ… Yesβœ… Yesβœ… Yes

πŸ’‘ Key Takeaways for Decision Making

Pick countries-and-timezones when timezone handling is part of your core requirements. The combined data reduces dependency count and keeps timezone-country mappings consistent.

Pick countries-list for balanced features with currencies and phone codes. It's a solid middle ground for forms that need more than just names and codes.

Avoid country-data in new projects. The lack of active maintenance means outdated data and no TypeScript support. Migrate existing projects to i18n-iso-countries or countries-list.

Pick country-list for minimal needs. If you only need name-code conversion without extra metadata, this keeps your bundle small.

Pick i18n-iso-countries for multilingual applications. The translation support is unmatched and worth the extra bundle size for global products.

Pick iso-3166-1 for validation and normalization. When standards compliance matters more than user-facing features, this focused package delivers.

πŸ”— Combining Packages for Complex Needs

Sometimes one package isn't enough. Here's how to combine them safely:

// Example: i18n-iso-countries + countries-list for full coverage
import countries from 'i18n-iso-countries';
import { countries as countryData } from 'countries-list';
import enLocale from 'i18n-iso-countries/langs/en.json';

countries.registerLocale(enLocale);

function getCompleteCountryData(code, locale) {
  return {
    code,
    name: countries.getName(code, locale),
    currency: countryData[code]?.currency,
    phoneCode: countryData[code]?.phoneCode,
    iso3: countryData[code]?.iso3
  };
}

// Usage
const us = getCompleteCountryData('US', 'en');
// { code: 'US', name: 'United States', currency: 'USD', phoneCode: '+1', iso3: 'USA' }

🏁 Final Recommendation

For most frontend applications, start with countries-list for its balance of features and simplicity. Add i18n-iso-countries if you need translations. Reach for countries-and-timezones only when timezone data is a core requirement. Avoid country-data entirely for new work. Keep iso-3166-1 in mind for validation-heavy scenarios where standards matter most.

How to Choose: i18n-iso-countries vs countries-list vs countries-and-timezones vs country-data vs country-list vs iso-3166-1

  • i18n-iso-countries:

    Choose i18n-iso-countries when internationalization and translations are your top priority. It supports country names in 100+ languages and follows ISO 3166 standards closely. This package excels in multilingual applications, e-commerce platforms serving global audiences, or any project where displaying country names in the user's language matters.

  • countries-list:

    Choose countries-list if you need a lightweight solution with country names, ISO codes, and basic metadata like currency and phone codes. It works well for simple dropdowns, contact forms, or any scenario where you need country selection without heavy localization requirements. The API is straightforward and easy to integrate quickly.

  • countries-and-timezones:

    Choose countries-and-timezones when you need both country data and timezone information in a single package. It's ideal for applications that require timezone-aware features like scheduling, meeting planners, or global event displays. The package combines ISO country codes with timezone mappings, reducing the need for multiple dependencies.

  • country-data:

    Avoid country-data for new projects as it is no longer actively maintained. While it once offered comprehensive country information including flags and currencies, newer alternatives provide better TypeScript support and more frequent data updates. Consider i18n-iso-countries or countries-and-timezones instead for production applications.

  • country-list:

    Choose country-list when you need the simplest possible solution β€” just ISO codes and country names with minimal bundle impact. It's perfect for basic country selectors where you don't need currencies, timezones, or translations. The small API surface means less to learn and fewer breaking changes over time.

  • iso-3166-1:

    Choose iso-3166-1 when you need strict ISO 3166-1 standard compliance without extra features. It's suitable for validation, data normalization, or backend services where standards adherence matters more than user-facing display. The focused scope means less bloat but also less convenience for frontend UI needs.

README for i18n-iso-countries

i18n-iso-countries

i18n for ISO 3166-1 country codes. We support Alpha-2, Alpha-3 and Numeric codes from 'Wikipedia: Officially assigned code elements'

Installing

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"));

Code to Country

Get the name of a country by its ISO 3166-1 Alpha-2, Alpha-3 or Numeric code

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

Get aliases/short name using select

// 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"]

Get all names by their ISO 3166-1 Alpha-2 code

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' }

Supported languages (ISO 639-1)

In case you want to add new language, please refer ISO 639-1 table.

  • af: Afrikaans
  • am: Amharic
  • ar: Arabic
  • az: Azerbaijani
  • be: Belorussian
  • bg: Bulgarian
  • bn: Bengali
  • br: Breton
  • bs: Bosnian
  • ca: Catalan
  • cs: Czech
  • cy: Cymraeg
  • da: Danish
  • de: German
  • dv: Dhivehi
  • en: English
  • es: Spanish
  • et: Estonian
  • eu: Basque
  • fa: Persian
  • fi: Finnish
  • fr: French
  • ga: Irish
  • gl: Galician
  • el: Greek
  • ha: Hausa
  • he: Hebrew
  • hi: Hindi
  • hr: Croatian
  • hu: Hungarian
  • hy: Armenian
  • is: Icelandic
  • it: Italian
  • id: Indonesian
  • ja: Japanese
  • ka: Georgian
  • kk: Kazakh
  • km: Khmer
  • ko: Korean
  • ku: Kurdish
  • ky: Kyrgyz
  • lt: Lithuanian
  • lv: Latvian
  • mk: Macedonian
  • ml: Malayalam
  • mn: Mongolian
  • mr: Marathi
  • ms: Malay
  • mt: Maltese
  • nb: Norwegian BokmΓ₯l
  • nl: Dutch
  • nn: Norwegian Nynorsk
  • no: Norwegian
  • pl: Polish
  • ps: Pashto
  • pt: Portuguese
  • ro: Romanian
  • ru: Russian
  • sd: Sindhi
  • sk: Slovak
  • sl: Slovene
  • so: Somali
  • sq: Albanian
  • sr: Serbian
  • sv: Swedish
  • sw: Swahili
  • ta: Tamil
  • tg: Tajik
  • th: Thai
  • tk: Turkmen
  • tr: Turkish
  • tt: Tatar
  • ug: Uyghur
  • uk: Ukrainian
  • ur: Urdu
  • uz: Uzbek
  • zh: Chinese
  • vi: Vietnamese

List of ISO 639-1 codes

Get all supported languages (ISO 639-1)

var countries = require("i18n-iso-countries");
console.log("List of supported languages => " + countries.getSupportedLanguages());
// List of supported languages => ["cy", "dv", "sw", "eu", "af", "am", ...]

Country to Code

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

Codes

Convert Alpha-3 to Alpha-2 code

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)

Convert Numeric to Alpha-2 code

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)

Convert Alpha-2 to Alpha-3 code

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)

Convert Numeric to Alpha-3 code

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)

Convert Alpha-3 to Numeric code

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

Convert Alpha-2 to Numeric code

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

Get all Alpha-2 codes

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' }

Get all Alpha-3 codes

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' }

Get all Numeric codes

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' }

Validate country code

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

Contribution

To add a language:

  • add a json file under langs/
  • add the language to the list in supportedLocales.json at the top
  • add language to section Supported languages in README.md
  • add language to keywords in package.json
  • run npm run lint and npm test
  • open a PR on GitHub

You can check codes here: https://www.iso.org/obp/ui/#home