Currency Formatting by Locale with Intl.NumberFormat
Format currency values for any locale and currency code using Intl.NumberFormat. Learn about currency display modes, symbol placement, and locale-specific currency conventions.
Detailed Explanation
Currency Formatting Across Locales
Currency formatting is one of the most important uses of Intl.NumberFormat. The position of the currency symbol, the number of decimal places, and the grouping style all vary by locale.
Basic Currency Formatting
const amount = 1234.5;
new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' })
.format(amount); // "$1,234.50"
new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY' })
.format(amount); // "¥1,235" (no decimals for yen)
new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' })
.format(amount); // "1.234,50 €"
new Intl.NumberFormat('ar-SA', { style: 'currency', currency: 'SAR' })
.format(amount); // "١٬٢٣٤٫٥٠ ر.س."
Currency Display Options
The currencyDisplay option controls how the currency is represented:
const opts = { style: 'currency', currency: 'USD' };
// "symbol" (default): "$1,234.50"
// "narrowSymbol": "$1,234.50" (uses narrow symbol when available)
// "code": "USD 1,234.50"
// "name": "1,234.50 US dollars"
Locale-Specific Conventions
Important differences across locales:
- Symbol position: Before the number (en-US: $100) or after (de-DE: 100 €)
- Decimal digits: JPY has 0, most currencies have 2, BHD has 3
- Negative amounts: (USD 100) vs -$100 vs -100 $
- Grouping: Indian rupees use lakh grouping (1,23,456.00)
The currencySign Option
new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
currencySign: 'accounting',
}).format(-1234.5); // "($1,234.50)" instead of "-$1,234.50"
The accounting sign wraps negative amounts in parentheses, which is the standard in financial reporting.
Use Case
Currency formatting is critical for e-commerce platforms, banking applications, invoicing systems, and any software that handles money. A SaaS product serving global customers must display subscription prices in the user's local format. Payment processing UIs must show transaction amounts correctly. International financial reports need to present multi-currency data with proper formatting. Using Intl.NumberFormat with currency style ensures amounts are always displayed in the locally expected format.
Try It — Locale String Tester
Related Topics
Intl.NumberFormat Basics: Locale-Aware Number Formatting
Intl.NumberFormat
Intl.DisplayNames API: Language, Region, Script, and Currency Names
Intl.DisplayNames
Number Grouping Styles by Locale: Indian, Western, and East Asian
Intl.NumberFormat
Compact Number Notation (1K, 1M, 1B) with Intl.NumberFormat
Intl.NumberFormat
Percent Formatting with Intl.NumberFormat
Intl.NumberFormat