ISO 4217 currency codes are three-letter codes that represent currencies worldwide. This comprehensive guide covers all major currency codes essential for e-commerce, international payments, and financial applications.
Table of Contents
- What Are ISO 4217 Currency Codes?
- Currency Code Structure
- Major World Currencies
- Using Currency Codes in Development
- Currency Formatting
- E-Commerce Implementation
- Complete Currency List
What Are ISO 4217 Currency Codes?
ISO 4217 is the international standard for currency codes maintained by the International Organization for Standardization (ISO). These codes are used globally for:
- E-commerce: Product pricing and checkout
- Banking: International wire transfers
- APIs: Payment processing, forex data
- Financial systems: Accounting, invoicing
- Travel: Multi-currency booking systems
- Stock markets: Trading and reporting
Standard Format: Currency codes follow a strict pattern - the first two letters are the ISO 3166-1 alpha-2 country code, and the third letter is usually the initial of the currency name.
Examples:
- USD = US (United States) + D (Dollar)
- GBP = GB (Great Britain) + P (Pound)
- JPY = JP (Japan) + Y (Yen)
Currency Code Structure
Three-Letter Alphabetic Code
Format: Three uppercase letters (XXX)
Examples:
- USD (US Dollar)
- EUR (Euro)
- GBP (British Pound)
- JPY (Japanese Yen)
Three-Digit Numeric Code
Each currency also has a numeric code for systems that don't support letters.
Examples:
- USD = 840
- EUR = 978
- GBP = 826
- JPY = 392
Minor Units (Decimal Places)
Currencies have different numbers of decimal places:
| currency | decimals | example |
|---|---|---|
| USD, EUR, GBP | 2 | $10.50 |
| JPY, KRW | 0 | ¥1050 |
| BHD, KWD | 3 | 1.050 KWD |
// Currency with decimal info
const currencies = {
USD: { decimals: 2, symbol: '$' },
EUR: { decimals: 2, symbol: '€' },
JPY: { decimals: 0, symbol: '¥' },
BHD: { decimals: 3, symbol: 'BD' }
};
Major World Currencies
Most Traded Currencies (The "Majors")
| Currency | Code | Symbol | Country/Region | Decimal Places |
|---|---|---|---|---|
| United States Dollar | USD | $ | United States | 2 |
| Euro | EUR | € | Eurozone (19 countries) | 2 |
| Japanese Yen | JPY | ¥ | Japan | 0 |
| British Pound Sterling | GBP | £ | United Kingdom | 2 |
| Swiss Franc | CHF | CHF | Switzerland | 2 |
| Canadian Dollar | CAD | C$ | Canada | 2 |
| Australian Dollar | AUD | A$ | Australia | 2 |
| New Zealand Dollar | NZD | NZ$ | New Zealand | 2 |
View USD details | View EUR details | View GBP details
Other Major Currencies
| Currency | Code | Symbol | Country | Decimal Places |
|---|---|---|---|---|
| Chinese Yuan Renminbi | CNY | ¥ | China | 2 |
| Indian Rupee | INR | ₹ | India | 2 |
| South Korean Won | KRW | ₩ | South Korea | 0 |
| Mexican Peso | MXN | $ | Mexico | 2 |
| Brazilian Real | BRL | R$ | Brazil | 2 |
| South African Rand | ZAR | R | South Africa | 2 |
| Singapore Dollar | SGD | S$ | Singapore | 2 |
| Hong Kong Dollar | HKD | HK$ | Hong Kong | 2 |
| Swedish Krona | SEK | kr | Sweden | 2 |
| Norwegian Krone | NOK | kr | Norway | 2 |
| Danish Krone | DKK | kr | Denmark | 2 |
Middle East & Gulf Currencies
| Currency | Code | Symbol | Country | Decimal Places |
|---|---|---|---|---|
| Saudi Riyal | SAR | ﷼ | Saudi Arabia | 2 |
| UAE Dirham | AED | د.إ | United Arab Emirates | 2 |
| Kuwaiti Dinar | KWD | KD | Kuwait | 3 |
| Bahraini Dinar | BHD | BD | Bahrain | 3 |
| Qatari Riyal | QAR | ﷼ | Qatar | 2 |
| Israeli New Shekel | ILS | ₪ | Israel | 2 |
| Turkish Lira | TRY | ₺ | Turkey | 2 |
High-Value Currencies: Kuwaiti Dinar (KWD) and Bahraini Dinar (BHD) use 3 decimal places because they are high-value currencies. 1 KWD ≈ 3.25 USD.
Eurozone Countries (Using EUR)
The Euro is used by 19 EU member states:
Austria, Belgium, Cyprus, Estonia, Finland, France, Germany, Greece, Ireland, Italy, Latvia, Lithuania, Luxembourg, Malta, Netherlands, Portugal, Slovakia, Slovenia, Spain
const eurozoneCountries = [
'AT', 'BE', 'CY', 'EE', 'FI', 'FR', 'DE', 'GR', 'IE',
'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PT', 'SK', 'SI', 'ES'
];
function usesEuro(countryCode) {
return eurozoneCountries.includes(countryCode);
}
console.log(usesEuro('DE')); // true (Germany)
console.log(usesEuro('GB')); // false (UK uses GBP)
Cryptocurrencies
While not official ISO currencies, some codes are reserved:
| Currency | Code | Symbol | Type |
|---|---|---|---|
| Bitcoin | XBT | ₿ | Cryptocurrency |
| Ethereum | ETH | Ξ | Cryptocurrency |
Note: ISO 4217 doesn't officially recognize cryptocurrencies. The codes shown are used by some exchanges but are not standardized.
Using Currency Codes in Development
Basic Currency Object
const currencies = {
USD: {
code: 'USD',
symbol: '$',
name: 'US Dollar',
country: 'US',
decimals: 2
},
EUR: {
code: 'EUR',
symbol: '€',
name: 'Euro',
countries: ['DE', 'FR', 'IT', 'ES'], // Multiple countries
decimals: 2
},
GBP: {
code: 'GBP',
symbol: '£',
name: 'British Pound',
country: 'GB',
decimals: 2
},
JPY: {
code: 'JPY',
symbol: '¥',
name: 'Japanese Yen',
country: 'JP',
decimals: 0 // No cents
}
};
// Get currency info
function getCurrency(code) {
return currencies[code];
}
const usd = getCurrency('USD');
console.log(usd.symbol); // "$"
console.log(usd.decimals); // 2
TypeScript Interface
interface Currency {
code: string;
symbol: string;
name: string;
country?: string;
countries?: string[];
decimals: number;
numericCode?: number;
}
const USD: Currency = {
code: 'USD',
symbol: '$',
name: 'US Dollar',
country: 'US',
decimals: 2,
numericCode: 840
};
Currency Selector Component (React)
import { useState } from 'react';
const currencies = [
{ code: 'USD', name: 'US Dollar', symbol: '$' },
{ code: 'EUR', name: 'Euro', symbol: '€' },
{ code: 'GBP', name: 'British Pound', symbol: '£' },
{ code: 'JPY', name: 'Japanese Yen', symbol: '¥' },
{ code: 'CAD', name: 'Canadian Dollar', symbol: 'C$' },
{ code: 'AUD', name: 'Australian Dollar', symbol: 'A$' }
];
function CurrencySelector({ value, onChange }) {
return (
<select
value={value}
onChange={(e) => onChange(e.target.value)}
className="currency-select"
>
{currencies.map(currency => (
<option key={currency.code} value={currency.code}>
{currency.symbol} {currency.code} - {currency.name}
</option>
))}
</select>
);
}
// Usage
function PriceInput() {
const [currency, setCurrency] = useState('USD');
const [amount, setAmount] = useState('');
const selectedCurrency = currencies.find(c => c.code === currency);
return (
<div className="price-input">
<CurrencySelector value={currency} onChange={setCurrency} />
<input
type="number"
value={amount}
onChange={(e) => setAmount(e.target.value)}
placeholder="0.00"
/>
<span className="preview">
{selectedCurrency?.symbol}{amount || '0.00'}
</span>
</div>
);
}
Currency Formatting
JavaScript Intl.NumberFormat
// Format currency using browser's Intl API
function formatCurrency(amount, currencyCode, locale = 'en-US') {
return new Intl.NumberFormat(locale, {
style: 'currency',
currency: currencyCode
}).format(amount);
}
// Examples
console.log(formatCurrency(1234.56, 'USD', 'en-US'));
// "$1,234.56"
console.log(formatCurrency(1234.56, 'EUR', 'de-DE'));
// "1.234,56 €"
console.log(formatCurrency(1234.56, 'GBP', 'en-GB'));
// "£1,234.56"
console.log(formatCurrency(1234, 'JPY', 'ja-JP'));
// "¥1,234" (no decimals)
console.log(formatCurrency(1234.567, 'KWD', 'ar-KW'));
// "د.ك. 1,234.567" (3 decimals)
Custom Formatting Function
const currencyConfig = {
USD: { symbol: '$', symbolPosition: 'before', decimals: 2 },
EUR: { symbol: '€', symbolPosition: 'after', decimals: 2 },
GBP: { symbol: '£', symbolPosition: 'before', decimals: 2 },
JPY: { symbol: '¥', symbolPosition: 'before', decimals: 0 }
};
function formatPrice(amount, currencyCode) {
const config = currencyConfig[currencyCode];
if (!config) return \`\${amount} \${currencyCode}\`;
const formatted = config.decimals > 0
? amount.toFixed(config.decimals)
: Math.round(amount).toString();
// Add thousands separator
const parts = formatted.split('.');
parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');
const withSeparator = parts.join('.');
return config.symbolPosition === 'before'
? \`\${config.symbol}\${withSeparator}\`
: \`\${withSeparator} \${config.symbol}\`;
}
console.log(formatPrice(1234.56, 'USD')); // "$1,234.56"
console.log(formatPrice(1234.56, 'EUR')); // "1,234.56 €"
console.log(formatPrice(1234.56, 'JPY')); // "¥1,235"
Handling Decimal Places
// Store amounts in smallest currency unit (cents)
const priceInCents = 1999; // $19.99
function centsToAmount(cents, currencyCode) {
const decimals = getDecimals(currencyCode);
return cents / Math.pow(10, decimals);
}
function amountToCents(amount, currencyCode) {
const decimals = getDecimals(currencyCode);
return Math.round(amount * Math.pow(10, decimals));
}
function getDecimals(currencyCode) {
const decimalsMap = {
USD: 2, EUR: 2, GBP: 2,
JPY: 0, KRW: 0,
BHD: 3, KWD: 3
};
return decimalsMap[currencyCode] || 2;
}
// Examples
console.log(centsToAmount(1999, 'USD')); // 19.99
console.log(amountToCents(19.99, 'USD')); // 1999
console.log(centsToAmount(1999, 'JPY')); // 1999 (no conversion)
console.log(amountToCents(1999, 'JPY')); // 1999
Important: Always store monetary values as integers (smallest unit) to avoid floating-point precision errors. Store $19.99 as 1999 cents, not as 19.99.
E-Commerce Implementation
Multi-Currency Product Pricing
const product = {
id: 'prod_123',
name: 'Wireless Headphones',
prices: {
USD: 9999, // $99.99 (stored in cents)
EUR: 8999, // €89.99
GBP: 7999, // £79.99
JPY: 11000 // ¥11,000
}
};
function getPrice(product, currencyCode) {
return product.prices[currencyCode];
}
function displayPrice(product, currencyCode) {
const priceInCents = getPrice(product, currencyCode);
const amount = centsToAmount(priceInCents, currencyCode);
return formatCurrency(amount, currencyCode);
}
console.log(displayPrice(product, 'USD')); // "$99.99"
console.log(displayPrice(product, 'EUR')); // "€89.99"
console.log(displayPrice(product, 'JPY')); // "¥11,000"
Currency Conversion
// Fetch live exchange rates
async function getExchangeRates(baseCurrency = 'USD') {
const response = await fetch(
\`https://api.exchangerate-api.com/v4/latest/\${baseCurrency}\`
);
const data = await response.json();
return data.rates;
}
// Convert between currencies
async function convertCurrency(amount, from, to) {
if (from === to) return amount;
const rates = await getExchangeRates(from);
const rate = rates[to];
if (!rate) throw new Error(\`No rate found for \${to}\`);
return amount * rate;
}
// Usage
const usdAmount = 100;
const eurAmount = await convertCurrency(usdAmount, 'USD', 'EUR');
console.log(\`$\${usdAmount} = €\${eurAmount.toFixed(2)}\`);
// "$100 = €92.15" (example rate)
Stripe Payment Intent (Multi-Currency)
// Create payment intent with currency
const stripe = require('stripe')('sk_test_...');
async function createPayment(amount, currency) {
// Ensure amount is in smallest unit
const amountInSmallestUnit = amountToCents(amount, currency);
const paymentIntent = await stripe.paymentIntents.create({
amount: amountInSmallestUnit,
currency: currency.toLowerCase(), // Stripe uses lowercase
payment_method_types: ['card'],
});
return paymentIntent;
}
// Examples
await createPayment(99.99, 'USD'); // amount: 9999
await createPayment(89.99, 'EUR'); // amount: 8999
await createPayment(11000, 'JPY'); // amount: 11000 (no conversion)
PayPal Integration
// PayPal checkout with currency
const order = {
intent: 'CAPTURE',
purchase_units: [{
amount: {
currency_code: 'USD', // ISO 4217 code
value: '99.99' // String format
},
description: 'Wireless Headphones'
}]
};
// Multiple currencies
const currencies = ['USD', 'EUR', 'GBP'];
const paypalButtons = currencies.map(currency => ({
currency: currency,
amount: getAmountForCurrency(currency)
}));
Complete Currency List
Americas
| Currency | Code | Symbol | Country | Decimals |
|---|---|---|---|---|
| US Dollar | USD | $ | United States | 2 |
| Canadian Dollar | CAD | C$ | Canada | 2 |
| Mexican Peso | MXN | $ | Mexico | 2 |
| Brazilian Real | BRL | R$ | Brazil | 2 |
| Argentine Peso | ARS | $ | Argentina | 2 |
| Chilean Peso | CLP | $ | Chile | 0 |
| Colombian Peso | COP | $ | Colombia | 2 |
| Peruvian Sol | PEN | S/ | Peru | 2 |
Europe
| Currency | Code | Symbol | Country | Decimals |
|---|---|---|---|---|
| Euro | EUR | € | Eurozone | 2 |
| British Pound | GBP | £ | United Kingdom | 2 |
| Swiss Franc | CHF | CHF | Switzerland | 2 |
| Swedish Krona | SEK | kr | Sweden | 2 |
| Norwegian Krone | NOK | kr | Norway | 2 |
| Danish Krone | DKK | kr | Denmark | 2 |
| Polish Zloty | PLN | zł | Poland | 2 |
| Czech Koruna | CZK | Kč | Czech Republic | 2 |
| Hungarian Forint | HUF | Ft | Hungary | 2 |
| Romanian Leu | RON | lei | Romania | 2 |
| Russian Ruble | RUB | ₽ | Russia | 2 |
| Turkish Lira | TRY | ₺ | Turkey | 2 |
| Ukrainian Hryvnia | UAH | ₴ | Ukraine | 2 |
Asia-Pacific
| Currency | Code | Symbol | Country | Decimals |
|---|---|---|---|---|
| Japanese Yen | JPY | ¥ | Japan | 0 |
| Chinese Yuan | CNY | ¥ | China | 2 |
| Indian Rupee | INR | ₹ | India | 2 |
| South Korean Won | KRW | ₩ | South Korea | 0 |
| Australian Dollar | AUD | A$ | Australia | 2 |
| New Zealand Dollar | NZD | NZ$ | New Zealand | 2 |
| Singapore Dollar | SGD | S$ | Singapore | 2 |
| Hong Kong Dollar | HKD | HK$ | Hong Kong | 2 |
| Malaysian Ringgit | MYR | RM | Malaysia | 2 |
| Thai Baht | THB | ฿ | Thailand | 2 |
| Indonesian Rupiah | IDR | Rp | Indonesia | 2 |
| Philippine Peso | PHP | ₱ | Philippines | 2 |
| Vietnamese Dong | VND | ₫ | Vietnam | 0 |
| Pakistani Rupee | PKR | ₨ | Pakistan | 2 |
| Bangladeshi Taka | BDT | ৳ | Bangladesh | 2 |
Middle East & Africa
| Currency | Code | Symbol | Country | Decimals |
|---|---|---|---|---|
| Saudi Riyal | SAR | ﷼ | Saudi Arabia | 2 |
| UAE Dirham | AED | د.إ | UAE | 2 |
| Kuwaiti Dinar | KWD | KD | Kuwait | 3 |
| Bahraini Dinar | BHD | BD | Bahrain | 3 |
| Qatari Riyal | QAR | ﷼ | Qatar | 2 |
| Israeli Shekel | ILS | ₪ | Israel | 2 |
| Egyptian Pound | EGP | £ | Egypt | 2 |
| South African Rand | ZAR | R | South Africa | 2 |
| Nigerian Naira | NGN | ₦ | Nigeria | 2 |
| Kenyan Shilling | KES | KSh | Kenya | 2 |
Best Practices
1. Always Use ISO Codes
// ✅ Good - Use standard codes
const price = {
amount: 9999,
currency: 'USD'
};
// ❌ Bad - Using symbols or names
const price = {
amount: 9999,
currency: '$' // Ambiguous (USD? CAD? MXN?)
};
const price = {
amount: 9999,
currency: 'dollars' // Not standard
};
2. Store in Smallest Unit
// ✅ Good - Store as integer (cents)
const price = {
amount: 1999, // $19.99
currency: 'USD'
};
// ❌ Bad - Floating point issues
const price = {
amount: 19.99, // Can cause rounding errors
currency: 'USD'
};
// Example of floating point error
console.log(0.1 + 0.2); // 0.30000000000000004
console.log(10 + 20); // 30 (exact)
3. Handle Zero-Decimal Currencies
const zeroDecimalCurrencies = ['JPY', 'KRW', 'VND', 'CLP'];
function isZeroDecimal(currencyCode) {
return zeroDecimalCurrencies.includes(currencyCode);
}
// Format correctly
function formatAmount(amount, currency) {
if (isZeroDecimal(currency)) {
return amount; // No division needed
}
return amount / 100; // Convert cents to dollars
}
console.log(formatAmount(1999, 'USD')); // 19.99
console.log(formatAmount(1999, 'JPY')); // 1999
4. Currency Validation
const validCurrencies = new Set([
'USD', 'EUR', 'GBP', 'JPY', 'CAD', 'AUD', 'CHF', 'CNY',
// ... all valid ISO 4217 codes
]);
function isValidCurrency(code) {
return validCurrencies.has(code.toUpperCase());
}
// Usage
if (!isValidCurrency(userInput)) {
throw new Error('Invalid currency code');
}
5. User Location Detection
// Detect user's currency based on location
async function detectUserCurrency() {
try {
// Get user's country from IP
const response = await fetch('https://ipapi.co/json/');
const data = await response.json();
// Map country to currency
const countryCurrencyMap = {
'US': 'USD',
'GB': 'GBP',
'CA': 'CAD',
'AU': 'AUD',
'DE': 'EUR',
'FR': 'EUR',
'JP': 'JPY',
// ... more mappings
};
return countryCurrencyMap[data.country_code] || 'USD';
} catch {
return 'USD'; // Default fallback
}
}
// Pre-select currency in dropdown
const userCurrency = await detectUserCurrency();
document.getElementById('currency').value = userCurrency;
Summary
ISO 4217 currency codes are essential for any international application. Always use three-letter codes, store amounts in the smallest unit, and be aware of currencies with different decimal places.
Key Takeaways:
✅ Use ISO 4217 three-letter codes (USD, EUR, GBP)
✅ Store monetary values as integers (cents, not dollars)
✅ Handle zero-decimal currencies (JPY, KRW) correctly
✅ Use Intl.NumberFormat for proper currency formatting
✅ Validate currency codes against ISO standard
✅ Account for 3-decimal currencies (KWD, BHD)
✅ Never use floating-point for money calculations