Currency Formatter
Format numbers as currency with proper localization
Format numbers as currency strings with proper localization. Display prices correctly for different regions with accurate symbols, decimals, and separators.
Format numbers as currency strings with proper localization. Display prices correctly for different regions with accurate symbols, decimals, and separators.
Currency formatting follows locale-specific conventions that vary dramatically across countries. Here's exactly how to get properly formatted output:
The Intl.NumberFormat API (part of ECMAScript Internationalization API) handles currency formatting by consulting Unicode CLDR (Common Locale Data Repository) data for each locale. This data encodes country-specific rules that go far beyond simple symbol substitution. In the US, the dollar sign precedes the number with no space ($100). In France, there's a non-breaking space between the number and euro sign (100 €). In Germany, commas separate thousands and periods separate decimals (1.234,56 €). In India, the lakhs system groups digits differently after the first three: 1,23,456.78 instead of 123,456.78. Some locales like Switzerland use multiple currency symbols depending on the region (CHF for German-speaking, Franc Suisse for French-speaking). The currency display symbol option shows localized symbols (€ vs EUR), while the code option always shows the ISO code. Understanding these nuances prevents embarrassing mistakes in international applications — displaying '1.000.000 €' to a German user clearly means one million euros, but an American reader might interpret it as one thousand euros.
All ISO 4217 currency codes are supported, covering 160+ currencies worldwide. This includes major currencies (USD, EUR, GBP, JPY, CNY, INR), precious metals (XAU for gold, XAG for silver), and special drawing rights (XDR). The formatter uses your browser's built-in Intl.NumberFormat, which covers the same currency set as modern web standards.
A locale combines language and region to define formatting conventions. 'en-US' means English as used in the United States (dollar sign first, comma for thousands, period for decimals). 'vi-VN' means Vietnamese as used in Vietnam (dong symbol last, period for thousands, comma for decimals). 'ar-SA' means Arabic as used in Saudi Arabia (right-to-left text, Eastern Arabic numerals potentially). The locale controls everything except the currency itself.
Yes! You can set minimumFractionDigits and maximumFractionDigits independently. Most currencies default to 2 decimals, but you can override this. For Japanese Yen, set both to 0. For Kuwaiti Dinar (highest-valued currency at ~3.25 USD per KD), you might want 3 decimals. For microtransactions in Bitcoin pricing, you could use 8 decimals.
Browser implementations of Intl.NumberFormat rely on the underlying operating system's ICU (International Components for Unicode) library. Chrome and Edge use Chromium's ICU, Firefox bundles its own, and Safari uses macOS's ICU. Minor differences can appear in symbol spacing or digit shaping for certain locales. These differences are usually cosmetic and reflect legitimate regional variations.
Use the native Intl.NumberFormat constructor: new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(1234.56) returns '$1,234.56'. You can cache formatter instances for performance since creating them is relatively expensive. For server-side Node.js, the 'intl' polyfill provides the same API.
No. All formatting happens entirely in your browser using JavaScript's Intl.NumberFormat API. No data is sent to any server, stored in cookies, or logged anywhere. Your numbers and formatting choices remain completely private.