Skip to main content

Country data for TypeScript and React

@tw-labs/countries

Most apps need a country list sooner or later: a phone input, a shipping form, a currency picker. @tw-labs/countries gives you that data typed and ready, with lookups by ISO code, alpha-3 code, or dial code, and a useCountries hook for React. Import the whole dataset, or only the countries you use.

  • MIT license
  • TypeScript
  • Zero dependencies
  • Tree-shakeable
$ npm install @tw-labs/countries

GET /open-source/countries

Try it

This table is the published package running in your browser. Change a filter and the code beside it changes to match.

249 of 249 returned

CountryISODialCapitalCurrency
AfghanistanAF · AFG+93KabulAFN ؋
Aland IslandsAX · ALA+358MariehamnEUR €
AlbaniaAL · ALB+355TiranaALL L
AlgeriaDZ · DZA+213AlgiersDZD د.ج
American SamoaAS · ASM+1-684Pago PagoUSD $
AndorraAD · AND+376Andorra la VellaEUR €
AngolaAO · AGO+244LuandaAOA Kz
AnguillaAI · AIA+1-264The ValleyXCD $
AntarcticaAQ · ATA+672—
Antigua and BarbudaAG · ATG+1-268Saint John'sXCD $
ArgentinaAR · ARG+54Buenos AiresARS $
ArmeniaAM · ARM+374YerevanAMD ֏
ArubaAW · ABW+297OranjestadAWG ƒ
AustraliaAU · AUS+61CanberraAUD $
AustriaAT · AUT+43ViennaEUR €
AzerbaijanAZ · AZE+994BakuAZN ₼
BahamasBS · BHS+1-242NassauBSD $
BahrainBH · BHR+973ManamaBHD .د.ب
BangladeshBD · BGD+880DhakaBDT ৳
BarbadosBB · BRB+1-246BridgetownBBD $
BelarusBY · BLR+375MinskBYN Br
BelgiumBE · BEL+32BrusselsEUR €
BelizeBZ · BLZ+501BelmopanBZD $
BeninBJ · BEN+229Porto-NovoXOF Fr
BermudaBM · BMU+1-441HamiltonBMD $
BhutanBT · BTN+975ThimphuBTN Nu
BoliviaBO · BOL+591SucreBOB Bs.
Bosnia and HerzegovinaBA · BIH+387SarajevoBAM KM
BotswanaBW · BWA+267GaboroneBWP P
Bouvet IslandBV · BVT+47—NOK kr
BrazilBR · BRA+55BrasiliaBRL R$
British Indian Ocean TerritoryIO · IOT+246Diego GarciaUSD $
British Virgin IslandsVG · VGB+1-284Road TownUSD $
Brunei DarussalamBN · BRN+673Bandar Seri BegawanBND $
BulgariaBG · BGR+359SofiaBGN лв
Burkina FasoBF · BFA+226OuagadougouXOF Fr
BurundiBI · BDI+257GitegaBIF Fr
CambodiaKH · KHM+855Phnom PenhKHR ៛
CameroonCM · CMR+237YaoundeXAF Fr
CanadaCA · CAN+1OttawaCAD $
Cape VerdeCV · CPV+238PraiaCVE $
Cayman IslandsKY · CYM+1-345George TownKYD $
Central African RepublicCF · CAF+236BanguiXAF Fr
ChadTD · TCD+235N'DjamenaXAF Fr
ChileCL · CHL+56SantiagoCLP $
ChinaCN · CHN+86BeijingCNY ¥
Christmas IslandCX · CXR+61Flying Fish CoveAUD $
Cocos (Keeling) IslandsCC · CCK+61West IslandAUD $
ColombiaCO · COL+57BogotaCOP $
ComorosKM · COM+269MoroniKMF Fr
Congo, Democratic Republic of theCD · COD+243KinshasaCDF Fr
Congo, Republic of theCG · COG+242BrazzavilleXAF Fr
Cook IslandsCK · COK+682AvaruaNZD $
Costa RicaCR · CRI+506San JoseCRC ₡
Cote d'IvoireCI · CIV+225YamoussoukroXOF Fr
CroatiaHR · HRV+385ZagrebEUR €
CubaCU · CUB+53HavanaCUP $
CuracaoCW · CUW+599WillemstadANG ƒ
CyprusCY · CYP+357NicosiaEUR €
Czech RepublicCZ · CZE+420PragueCZK Kč
DenmarkDK · DNK+45CopenhagenDKK kr
DjiboutiDJ · DJI+253DjiboutiDJF Fr
DominicaDM · DMA+1-767RoseauXCD $
Dominican RepublicDO · DOM+1-809Santo DomingoDOP $
EcuadorEC · ECU+593QuitoUSD $
EgyptEG · EGY+20CairoEGP £
El SalvadorSV · SLV+503San SalvadorUSD $
Equatorial GuineaGQ · GNQ+240MalaboXAF Fr
EritreaER · ERI+291AsmaraERN Nfk
EstoniaEE · EST+372TallinnEUR €
EswatiniSZ · SWZ+268MbabaneSZL L
EthiopiaET · ETH+251Addis AbabaETB Br
Falkland Islands (Malvinas)FK · FLK+500StanleyFKP £
Faroe IslandsFO · FRO+298TorshavnDKK kr
FijiFJ · FJI+679SuvaFJD $
FinlandFI · FIN+358HelsinkiEUR €
FranceFR · FRA+33ParisEUR €
French GuianaGF · GUF+594CayenneEUR €
French PolynesiaPF · PYF+689PapeeteXPF Fr
French Southern TerritoriesTF · ATF+262Port-aux-FrancaisEUR €
GabonGA · GAB+241LibrevilleXAF Fr
GambiaGM · GMB+220BanjulGMD D
GeorgiaGE · GEO+995TbilisiGEL ₾
GermanyDE · DEU+49BerlinEUR €
GhanaGH · GHA+233AccraGHS ₵
GibraltarGI · GIB+350GibraltarGIP £
GreeceGR · GRC+30AthensEUR €
GreenlandGL · GRL+299NuukDKK kr
GrenadaGD · GRD+1-473Saint George'sXCD $
GuadeloupeGP · GLP+590Basse-TerreEUR €
GuamGU · GUM+1-671HagatnaUSD $
GuatemalaGT · GTM+502Guatemala CityGTQ Q
GuernseyGG · GGY+44Saint Peter PortGBP £
GuineaGN · GIN+224ConakryGNF Fr
Guinea-BissauGW · GNB+245BissauXOF Fr
GuyanaGY · GUY+592GeorgetownGYD $
HaitiHT · HTI+509Port-au-PrinceHTG G
Heard Island and McDonald IslandsHM · HMD+672—AUD $
Holy See (Vatican City State)VA · VAT+379Vatican CityEUR €
HondurasHN · HND+504TegucigalpaHNL L
Hong KongHK · HKG+852Hong KongHKD $
HungaryHU · HUN+36BudapestHUF Ft
IcelandIS · ISL+354ReykjavikISK kr
IndiaIN · IND+91New DelhiINR ₹
IndonesiaID · IDN+62JakartaIDR Rp
Iran, Islamic Republic ofIR · IRN+98TehranIRR ﷼
IraqIQ · IRQ+964BaghdadIQD ع.د
IrelandIE · IRL+353DublinEUR €
Isle of ManIM · IMN+44DouglasGBP £
IsraelIL · ISR+972JerusalemILS ₪
ItalyIT · ITA+39RomeEUR €
JamaicaJM · JAM+1-876KingstonJMD $
JapanJP · JPN+81TokyoJPY ¥
JerseyJE · JEY+44Saint HelierGBP £
JordanJO · JOR+962AmmanJOD د.ا
KazakhstanKZ · KAZ+7Nur-SultanKZT ₸
KenyaKE · KEN+254NairobiKES Ksh
KiribatiKI · KIR+686South TarawaAUD $
Korea, Democratic People's Republic ofKP · PRK+850PyongyangKPW ₩
Korea, Republic ofKR · KOR+82SeoulKRW ₩
KosovoXK · XKX+383PristinaEUR €
KuwaitKW · KWT+965Kuwait CityKWD د.ك
KyrgyzstanKG · KGZ+996BishkekKGS с
Lao People's Democratic RepublicLA · LAO+856VientianeLAK ₭
LatviaLV · LVA+371RigaEUR €
LebanonLB · LBN+961BeirutLBP ل.ل
LesothoLS · LSO+266MaseruLSL L
LiberiaLR · LBR+231MonroviaLRD $
LibyaLY · LBY+218TripoliLYD ل.د
LiechtensteinLI · LIE+423VaduzCHF Fr
LithuaniaLT · LTU+370VilniusEUR €
LuxembourgLU · LUX+352LuxembourgEUR €
MacaoMO · MAC+853MacaoMOP P
MadagascarMG · MDG+261AntananarivoMGA Ar
MalawiMW · MWI+265LilongweMWK MK
MalaysiaMY · MYS+60Kuala LumpurMYR RM
MaldivesMV · MDV+960MaleMVR Rf
MaliML · MLI+223BamakoXOF Fr
MaltaMT · MLT+356VallettaEUR €
Marshall IslandsMH · MHL+692MajuroUSD $
MartiniqueMQ · MTQ+596Fort-de-FranceEUR €
MauritaniaMR · MRT+222NouakchottMRU UM
MauritiusMU · MUS+230Port LouisMUR Rs
MayotteYT · MYT+262MamoudzouEUR €
MexicoMX · MEX+52Mexico CityMXN $
Micronesia, Federated States ofFM · FSM+691PalikirUSD $
Moldova, Republic ofMD · MDA+373ChisinauMDL L
MonacoMC · MCO+377MonacoEUR €
MongoliaMN · MNG+976UlaanbaatarMNT ₮
MontenegroME · MNE+382PodgoricaEUR €
MontserratMS · MSR+1-664PlymouthXCD $
MoroccoMA · MAR+212RabatMAD د.م.
MozambiqueMZ · MOZ+258MaputoMZN MT
MyanmarMM · MMR+95NaypyidawMMK K
NamibiaNA · NAM+264WindhoekNAD $
NauruNR · NRU+674YarenAUD $
NepalNP · NPL+977KathmanduNPR Rs
NetherlandsNL · NLD+31AmsterdamEUR €
New CaledoniaNC · NCL+687NoumeaXPF Fr
New ZealandNZ · NZL+64WellingtonNZD $
NicaraguaNI · NIC+505ManaguaNIO C$
NigerNE · NER+227NiameyXOF Fr
NigeriaNG · NGA+234AbujaNGN ₦
NiueNU · NIU+683AlofiNZD $
Norfolk IslandNF · NFK+672KingstonAUD $
North MacedoniaMK · MKD+389SkopjeMKD ден
Northern Mariana IslandsMP · MNP+1-670SaipanUSD $
NorwayNO · NOR+47OsloNOK kr
OmanOM · OMN+968MuscatOMR ﷼
PakistanPK · PAK+92IslamabadPKR Rs
PalauPW · PLW+680NgerulmudUSD $
Palestine, State ofPS · PSE+970RamallahILS ₪
PanamaPA · PAN+507Panama CityPAB B/.
Papua New GuineaPG · PNG+675Port MoresbyPGK K
ParaguayPY · PRY+595AsuncionPYG ₲
PeruPE · PER+51LimaPEN S/.
PhilippinesPH · PHL+63ManilaPHP ₱
PitcairnPN · PCN+870AdamstownNZD $
PolandPL · POL+48WarsawPLN zł
PortugalPT · PRT+351LisbonEUR €
Puerto RicoPR · PRI+1San JuanUSD $
QatarQA · QAT+974DohaQAR ﷼
ReunionRE · REU+262Saint-DenisEUR €
RomaniaRO · ROU+40BucharestRON lei
Russian FederationRU · RUS+7MoscowRUB ₽
RwandaRW · RWA+250KigaliRWF Fr
Saint BarthelemyBL · BLM+590GustaviaEUR €
Saint HelenaSH · SHN+290JamestownSHP £
Saint Kitts and NevisKN · KNA+1-869BasseterreXCD $
Saint LuciaLC · LCA+1-758CastriesXCD $
Saint Martin (French part)MF · MAF+590MarigotEUR €
Saint Pierre and MiquelonPM · SPM+508Saint-PierreEUR €
Saint Vincent and the GrenadinesVC · VCT+1-784KingstownXCD $
SamoaWS · WSM+685ApiaWST T
San MarinoSM · SMR+378San MarinoEUR €
Sao Tome and PrincipeST · STP+239Sao TomeSTN Db
Saudi ArabiaSA · SAU+966RiyadhSAR ﷼
SenegalSN · SEN+221DakarXOF Fr
SerbiaRS · SRB+381BelgradeRSD din
SeychellesSC · SYC+248VictoriaSCR Rs
Sierra LeoneSL · SLE+232FreetownSLL Le
SingaporeSG · SGP+65SingaporeSGD $
Sint Maarten (Dutch part)SX · SXM+1-721PhilipsburgANG ƒ
SlovakiaSK · SVK+421BratislavaEUR €
SloveniaSI · SVN+386LjubljanaEUR €
Solomon IslandsSB · SLB+677HoniaraSBD $
SomaliaSO · SOM+252MogadishuSOS Sh
South AfricaZA · ZAF+27PretoriaZAR R
South Georgia and the South Sandwich IslandsGS · SGS+500King Edward PointGBP £
South SudanSS · SSD+211JubaSSP £
SpainES · ESP+34MadridEUR €
Sri LankaLK · LKA+94Sri Jayawardenepura KotteLKR Rs
SudanSD · SDN+249KhartoumSDG £
SurinameSR · SUR+597ParamariboSRD $
Svalbard and Jan MayenSJ · SJM+47LongyearbyenNOK kr
SwedenSE · SWE+46StockholmSEK kr
SwitzerlandCH · CHE+41BernCHF Fr
Syrian Arab RepublicSY · SYR+963DamascusSYP £
TaiwanTW · TWN+886TaipeiTWD $
TajikistanTJ · TJK+992DushanbeTJS SM
ThailandTH · THA+66BangkokTHB ฿
Timor-LesteTL · TLS+670DiliUSD $
TogoTG · TGO+228LomeXOF Fr
TokelauTK · TKL+690—NZD $
TongaTO · TON+676Nuku'alofaTOP T$
Trinidad and TobagoTT · TTO+1-868Port of SpainTTD $
TunisiaTN · TUN+216TunisTND د.ت
TurkeyTR · TUR+90AnkaraTRY ₺
TurkmenistanTM · TKM+993AshgabatTMT T
Turks and Caicos IslandsTC · TCA+1-649Cockburn TownUSD $
TuvaluTV · TUV+688FunafutiAUD $
UgandaUG · UGA+256KampalaUGX Sh
UkraineUA · UKR+380KyivUAH ₴
United Arab EmiratesAE · ARE+971Abu DhabiAED د.إ
United KingdomGB · GBR+44LondonGBP £
United Republic of TanzaniaTZ · TZA+255DodomaTZS Sh
United StatesUS · USA+1Washington, D.C.USD $
United States Minor Outlying IslandsUM · UMI+1—USD $
UruguayUY · URY+598MontevideoUYU $
US Virgin IslandsVI · VIR+1-340Charlotte AmalieUSD $
UzbekistanUZ · UZB+998TashkentUZS so'm
VanuatuVU · VUT+678Port VilaVUV Vt
VenezuelaVE · VEN+58CaracasVES Bs.S
VietnamVN · VNM+84HanoiVND ₫
Wallis and FutunaWF · WLF+681Mata-UtuXPF Fr
Western SaharaEH · ESH+212El AaiunMAD د.م.
YemenYE · YEM+967SanaaYER ﷼
ZambiaZM · ZMB+260LusakaZMW ZK
ZimbabweZW · ZWE+263HarareZWL $

The call behind this table

ts
import { useCountries } from "@tw-labs/countries/react";

const countries = useCountries({
  includeFlags: true,
  sort: { by: "label", order: "asc" },
});

Usage

Look up a country

The core entry has no React dependency, so it runs in Node.js, Vue, Svelte, and Next.js Server Components.

ts
import { getCountryByCode, getCountryByPhone } from "@tw-labs/countries";

getCountryByCode("IN");
// { code: "IN", alpha3: "IND", label: "India", phone: "91",
//   capital: "New Delhi", continent: "Asia",
//   currency: { code: "INR", symbol: "₹", name: "Indian Rupee" },
//   timezones: ["Asia/Kolkata"] }

getCountryByPhone("971").map((c) => c.label);
// ["United Arab Emirates"]

Build a picker in React

useCountries filters, sorts, and adds flags. The /react entry has "use client" built in.

ts
import { useCountries } from "@tw-labs/countries/react";

export function CountrySelect() {
  const countries = useCountries({
    includeFlags: true,
    sort: { by: "label", order: "asc" },
  });

  return (
    <select>
      {countries.map((c) => (
        <option key={c.code} value={c.code}>
          {c.flagEmoji} {c.label} (+{c.phone})
        </option>
      ))}
    </select>
  );
}

Ship only what you use

When the countries are known at build time, import them by code and the rest of the dataset is tree-shaken away.

ts
import { US, GB, DE } from "@tw-labs/countries/data";

const shippingCountries = [US, GB, DE];

What You Get

  1. 249 countries and territories with ISO alpha-2 and alpha-3 codes
  2. Dial code, capital, continent, currency, and IANA timezones for each
  3. Flags as emoji, 20px and 40px PNG, and SVG
  4. Lookups by ISO code, alpha-3 code, or dial code
  5. useCountries hook with filtering, sorting, and optional flags
  6. Tree-shakeable /data subpath and zero runtime dependencies

Common Uses

  1. Country and dial-code pickers on phone number inputs
  2. Shipping and billing address forms
  3. Showing prices in a visitor's local currency symbol
  4. Timezone selection when scheduling calls or events

@tw-labs/countries FAQ

What data does @tw-labs/countries include?

For each of 249 countries and territories: the ISO 3166-1 alpha-2 and alpha-3 codes, English name, international dial code, capital, continent, currency code, symbol, and name, and the IANA timezones. Flag emoji and flag image URLs are added on request.

Does it work with Next.js Server Components?

Yes. The core entry has no React dependency, so getCountryByCode and getAllCountries run in Server Components. The /react entry ships with "use client" built in for the useCountries hook.

Does it work without React?

Yes. React is an optional peer dependency. The core utilities work in Node.js, Vue, Svelte, or any JavaScript runtime.

How do I keep the bundle small?

If you know the countries at build time, import them by code from @tw-labs/countries/data, for example import { US, GB } from "@tw-labs/countries/data". Only those objects are bundled. Runtime lookups such as getCountryByCode include the full dataset.

Where do the flag images come from?

Flag PNG and SVG URLs point to flagcdn.com. Emoji flags need no network request.

Is it free to use commercially?

Yes. It is MIT licensed, so you can use it in commercial and closed-source projects.

Built by TechWebster

The team behind the package builds apps too

TechWebster builds React, Next.js, and mobile apps for clients. If you want the people who wrote this package on your project, talk to us.