ISO 4217 currency code reference
ISO 4217 standardizes the codes used to identify currencies in pricing, accounting and payment systems. Each currency has a three-letter alphabetic code (USD, EUR), a three-digit numeric code (840, 978), and a defined minor unit — the number of decimal places it normally uses. This reference is searchable by code, name or country and highlights the often-missed minor-unit count.
How it works
The alphabetic code is constructed from the country’s ISO 3166-1 alpha-2 code plus a letter for the currency: GB + P = GBP (Pound), US + D = USD (Dollar). Supranational and special codes start with X (EUR is an exception that predates the rule; XAU is gold, XDR is the IMF Special Drawing Right).
The crucial field for software is the minor unit (exponent):
amount_major = amount_minor / 10^minor
USD, minor 2: 150 cents -> 1.50
JPY, minor 0: 150 yen -> 150
BHD, minor 3: 150 fils -> 0.150
Always store money as an integer count of minor units together with the currency code, then scale only when displaying. This prevents floating-point drift and makes the minor-unit table the single source of truth for formatting.
Tips and notes
- Never assume two decimals. JPY, KRW, VND and UGX use 0, while BHD, KWD, JOD and TND use 3 — hardcoding
* 100corrupts these. - The numeric code is handy when a system cannot carry Latin letters, and it usually matches the country’s ISO 3166-1 numeric code.
- Codes beginning with
Xare not ordinary currencies; filter them out if you only want spendable money. - Pair every monetary amount with its currency code in storage — an amount without a currency is meaningless and a common source of bugs.