RepositoryJavaScript
thiagodp

thiagodp/country-to-currency

💵 Maps country codes (ISO 3166-1-alpha-2) to their default currency codes (ISO 4217)

59stars
9forks
0issues
1views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: currency-code

#1 Repository of the month

1
TINIX TRENDING·Topic: country-code

#1 Repository of the month

1
TINIX TRENDING·Topic: locale

#1 Repository of the month

npm (tag) License npm

country-to-currency

Maps country codes (ISO 3166-1 alpha-2) to their default currency codes (ISO 4217).

⚡ Just 3 KB uncompressed (1.2 KB gzipped), no external dependencies.

🎯 Work with browsers, NodeJS, and DenoJS. JavaScript and TypeScript.

Install

npm i country-to-currency

Note: Version 3.x dropped the support to CJS and UMD, in favor of using only EcmaScript Modules (ESM).

Usage

This library exports a default object that maps country codes to currency codes.

👉 Examples available in the folder examples.

TypeScript

From version 1.1.0 on, there are two union types available (TypeScript 3.4+ only):

  • Currencies, that contains all the currencies;
  • Countries, that contains all the countries.

Example using TypeScript on NodeJS:

  import countryToCurrency, { Currencies, Countries } from "country-to-currency";

Browser - without installing anything

NodeJS

// const countryToCurrency = require( 'country-to-currency' ); // v1.x and v2.0.2+
import countryToCurrency from 'country-to-currency'; // v3+
console.log( countryToCurrency[ 'US' ] ); // USD

Deno

// import countryToCurrency from "https://unpkg.com/country-to-currency/index.esm.js"; // v2.x
import countryToCurrency from "https://unpkg.com/country-to-currency"; // v3.x
console.log( countryToCurrency[ 'US' ] ); // USD

Currency symbols

Do you also need currency symbols? See how to get them. 💲

Notes

  • Total countries: 251
    • Imported: 249
    • Included: 5
    • Fixed: 2
  • Currencies assumed:
CountryCurrencyDetailsLegacyThanks to
Antarctica (AQ)USDAntarctica has no official currency@thiagodp
Palestine (PS)ILSGoogle@thiagodp
South Georgia and the South Sandwich Islands (GS)FKPWikipedia and https://gov.gs@danielrentz, @thiagodp
Netherlands Antilles (AN)ANGLegacy support. In 2026 Netherlands Antilles was split into separate countries.Yes@jayPare, @thiagodp
El Salvador (SV)USDSince 2001. Wikipedia@chaitanya-d, @thiagodp
Kosovo (XK)EURWikipedia and Geo Names@dukesilverr, @thiagodp
Buthan (BT)BTNAccording to Wikipedia@thiagodp

Contribute

Suggestions? Please open an Issue. Pull Requests? Make sure to edit generate.js instead of index.ts.

License

This library is inspired by Michael Rhodes' currency-code-map. The current project adds new currencies, fixes, offers support to browsers and DenoJS, updates dependencies, and provides new internal scripts.

MIT © Thiago Delgado Pinto

Similar Projects

Discover other similar projects and AI models.

RepositoryAstro
risan/country-flag-emoji-json

Country flag emojis in JSON format.

177
Oct 1, 2026
RepositoryJavaScript
react/react

The library for web and native user interfaces.

253.0k
Nov 30, 2026
RepositoryJavaScript
trekhleb/javascript-algorithms

📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings

196.8k
Jul 26, 2026
RepositoryTypeScript
morluto/rea

Reverse engineer anything with agents, from app behavior down to native binaries.

487.0k
Dec 2, 2026
RepositoryTypeScript
freeCodeCamp/freeCodeCamp

freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.

459.9k
Dec 2, 2026
RepositoryPython
practical-tutorials/project-based-learning

Curated list of project-based tutorials

290.9k
Nov 30, 2026
RepositoryTypeScript
vuejs/vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core

212.6k
Oct 10, 2024
Repository
getify/You-Dont-Know-JS

A book series (2 published editions) on the JS language.

184.8k
Oct 31, 2026
RepositoryJavaScript
samayo/country-json

A simple data of the world by country each in JSON format.

1.2k
Sep 7, 2026