Skip to content

Supported Countries

The library is addressed by country code, not currency code. Each country code resolves to a currency, locale, and separator configuration used for parsing and formatting.

See CountryCode vs CurrencyCode for the rationale behind this design.

Country table

Country CodeCountryCurrency CodeCurrencyLocaleDecimalGrouping
AEUnited Arab EmiratesAEDUAE Dirhamar-AE.,
ARArgentinaARSArgentine Pesoes-AR,.
AUAustraliaAUDAustralian Dollaren-AU.,
BRBrazilBRLBrazilian Realpt-BR,.
CACanadaCADCanadian Dollaren-CA.,
CHSwitzerlandCHFSwiss Francde-CH.'
CLChileCLPChilean Pesoes-CL,.
CNChinaCNYChinese Yuanzh-CN.,
COColombiaCOPColombian Pesoes-CO,.
DEGermanyEUREurode-DE,.
FRFranceEUREurofr-FR,
GBUnited KingdomGBPBritish Pounden-GB.,
INIndiaINRIndian Rupeeen-IN.,
JPJapanJPYJapanese Yenja-JP.,
KRSouth KoreaKRWSouth Korean Wonko-KR.,
MXMexicoMXNMexican Pesoes-MX.,
NONorwayNOKNorwegian Kronenb-NO,
NZNew ZealandNZDNew Zealand Dollaren-NZ.,
PTPortugalEUREuropt-PT,.
RURussiaRUBRussian Rubleru-RU,
SASaudi ArabiaSARSaudi Riyalar-SA.,
SESwedenSEKSwedish Kronasv-SE,
SGSingaporeSGDSingapore Dollaren-SG.,
USUnited StatesUSDUS Dollaren-US.,
ZASouth AfricaZARSouth African Randen-ZA.,

Notes

Currencies shared across countries

EUR is used by three supported countries. Each has a distinct locale and separator configuration, which affects both formatting output and string parsing:

ts
import { from } from '@eriveltondasilva/currency'

from(1999.99, 'DE').format() // => '1.999,99 €' (de-DE)
from(1999.99, 'FR').format() // => '1 999,99 €' (fr-FR — narrow space as grouping)
from(1999.99, 'PT').format() // => '1.999,99 €' (pt-PT)

All three return 'EUR' from currencyCode() and 2 fraction digits — but locale-aware operations like format() and parse() behave differently. Choose the country that matches your users' locale, not just the currency.

Zero fraction digits — JPY, CLP, COP, KRW

Some currencies have 0 fraction digits, meaning the minor unit equals the major unit and there are no subunits.

Country CodeCurrencyfractionDigits
JPJPY0
CLCLP0
COCOP0
KRKRW0
ts
from(500, 'JP').amount()     // => 500
from(500, 'JP').minorUnits() // => 500  (same value)
from(500, 'JP').subunits()   // => 0
from(500, 'JP').format()     // => '¥500'

from(5000, 'CL').format()    // => '$5.000'
from(5000, 'KR').format()    // => '₩5,000'

This also affects round() — steps smaller than 1 cannot be represented:

ts
from(500, 'JP').round(50).amount()  // => 500  ✅
from(500, 'JP').round(0.5).amount() // ❌ InvalidInputError

Switzerland (CHF) — apostrophe as grouping separator

Switzerland uses an apostrophe (') as the thousands separator, which is uncommon and can cause issues in environments that do not handle it correctly.

ts
from(1999.99, 'CH').format()         // => "CHF 1'999.99"
parse("CHF 1'999.90", 'CH').amount() // => 1999.9

India (INR) — South Asian grouping

India uses a non-standard grouping convention: the first group from the right contains three digits, and subsequent groups contain two digits (e.g. 1,00,00,000 for ten million).

ts
from(1000000, 'IN').format() // => '₹10,00,000.00'

The ind preset

Because in is a reserved keyword in JavaScript, the India preset is exported as ind:

ts
import { ind } from '@eriveltondasilva/currency/presets'

ind(1999.99).format() // => '₹1,999.99'

Resolving currency details at runtime

Use currencyCode() and locale() to inspect the resolved currency information of any instance:

ts
import { from } from '@eriveltondasilva/currency'

const price = from(100, 'BR')

price.currencyCode() // => 'BRL'
price.locale()       // => 'pt-BR'

Requesting additional countries

The library currently supports 25 country codes. If you need a country that is not listed, please open an issue on the GitHub repository.