Project 75, E-commerce and business
Multi-currency Prices
Show every visitor prices in money they understand. The page guesses the right currency, rounds to tidy price points and formats numbers the local way.
- Main API
- Intl.NumberFormat
- Guess
- navigator.language
- Dependencies
- None
- Your browser
- Checking
Prices around the world
Pick a currency or let the page guess. Switch rounding on and off and compare the formats.
| Currency | Locale format | Rate from USD |
|---|
How it works
- Guess the currencyIntl.Locale turns the browser language into a region, like en-GB into GB, and a small table maps that to a currency.
- Convert, then tidyThe dollar price is multiplied by the rate, then rounded up to a neat price point so a chair costs 229 euros, not 229.08.
- Format the local wayIntl.NumberFormat adds the right symbol, separators and decimals. Yen has no decimals and rupees group digits in lakhs.
const region = new Intl.Locale(navigator.language).maximize().region; // "GB"
const currency = { GB: "GBP", DE: "EUR", IN: "INR", BD: "BDT" }[region] || "USD";
const local = price * rates[currency];
new Intl.NumberFormat("en-IN", { style: "currency", currency: "INR" })
.format(124500); // "₹1,24,500.00"