Number Formatter Online — Add Commas, Currency & Intl.NumberFormat Code
Paste any number and instantly see it formatted as currency, decimal, or percentage for any locale in the world. Whether you need to add commas to a large number, format a price in euros, or generate the exact JavaScript code to replicate the result in your app — this tool covers all three in one place.
Unlike generic formatters that only add thousand separators, this tool exposes the full power of the browser's native Intl.NumberFormat API: choose the locale, currency, minimum and maximum decimal places, and grouping behavior. The live code snippet updates in real time so you can copy the exact call and drop it into your codebase.
How to Use the Number Formatter
Converting a number takes seconds:
- Enter your number in the Quick Mode bar at the top — it formats instantly with thousand separators in your locale, turning
1250500.75into1,250,500.75(US) or1.250.500,75(German/Brazilian) the moment you type. - Configure the format in the Technical Configuration panel — select a locale override, choose the format style (monetary, decimal, or percent), pick a currency code, and set minimum and maximum decimal places. The formatted result updates live with every change.
- Copy the result or the code — click "Copy Result" to grab the formatted string for documents and emails, or "Copy Code" to get the ready-to-paste
Intl.NumberFormatJavaScript snippet with your exact configuration pre-filled.
If you want to switch locale without changing your app language, use the Locale dropdown to override it — for example, view a BRL price formatted in en-US style for a US-facing export.
Number Formatting Examples
Here are real outputs to show how the same number looks in different configurations:
| Number | Locale | Style | Output |
|---|---|---|---|
1250500.75 |
en-US | currency (USD) | $1,250,500.75 |
1250500.75 |
pt-BR | currency (BRL) | R$ 1.250.500,75 |
1250500.75 |
de-DE | currency (EUR) | 1.250.500,75 € |
1250500.75 |
hi-IN | currency (INR) | ₹12,50,500.75 |
1250500.75 |
fr-CH | currency (CHF) | CHF 1'250'500.75 |
1250500.75 |
ar-SA | currency (SAR) | (Arabic-Indic digits, RTL) |
1250500 |
en-US | decimal (0 decimals) | 1,250,500 |
0.45 |
en-US | percent | 45% |
The India row reveals a crucial difference: ₹12,50,500.75 uses two-digit groups after the first three digits, following the South Asian lakh/crore system. Standard Western formatters get this wrong. The hi-IN locale handles it automatically via Intl.NumberFormat.
Switzerland shows another surprise: CHF 1'250'500.75 uses apostrophes as thousand separators — a quirk unique to Swiss formatting that no hand-rolled regex would produce correctly.
Intl.NumberFormat — The JavaScript Standard for Number Formatting
Intl.NumberFormat is the built-in JavaScript API for locale-aware number formatting. Every modern browser and Node.js runtime supports it without any external dependencies:
new Intl.NumberFormat('pt-BR', {
style: 'currency',
currency: 'BRL',
minimumFractionDigits: 2,
maximumFractionDigits: 2,
}).format(1250500.75);
// → "R$ 1.250.500,75"
The constructor takes a BCP 47 language tag (like en-US, de-DE, or hi-IN) and an options object. The style property controls whether the number is presented as a currency string, a decimal number, or a percentage. Setting useGrouping: false removes all separators — useful when you need a raw number string for an API payload.
Before Intl.NumberFormat was universally supported, developers shipped third-party libraries like numeral.js or maintained country-specific regex replacements just to add commas to a number. Today, zero extra bytes are needed. The browser does it all natively, handling edge cases like the Indian lakh system, Arabic-Indic digits, and Swiss apostrophe separators out of the box.
Common Use Cases
- E-commerce price display: Format the same database price for each storefront locale —
12.99renders as$12.99,€11,99,₹1,079.00, orR$ 12,99depending on the customer's country, all from a singleIntl.NumberFormatcall. - Financial dashboards: Display portfolio values, revenue figures, and market cap numbers with proper thousand separators so
1250000reads as1,250,000(US) or1.250.000(EU) at a glance. - Add commas to a number: The most common quick task — the Quick Mode bar at the top is specifically designed for this: paste your number, get the formatted version instantly, copy with one click.
- Invoices, PDFs, and reports: Generate locale-aware strings for documents going to clients in different countries where your server's default locale doesn't match the recipient's expectations.
- Learning and prototyping: Test how different
Intl.NumberFormatoption combinations interact before committing to a configuration in production code.
Frequently Asked Questions
How do I add commas to a number in JavaScript?
Use Intl.NumberFormat with the decimal style and useGrouping: true (the default): new Intl.NumberFormat('en-US').format(1250500) returns "1,250,500". For non-US locales, swap 'en-US' for the target locale — 'de-DE' uses dots as thousand separators and commas as decimal separators. This tool generates the ready-to-paste code snippet for any combination you configure.
What does minimumFractionDigits do in Intl.NumberFormat?
minimumFractionDigits sets the floor for decimal places — the formatted number always shows at least this many digits after the decimal point. Setting it to 2 ensures 1250500 formats as $1,250,500.00 rather than $1,250,500. maximumFractionDigits is the ceiling. When both are set to 2, the number always shows exactly two decimal places regardless of trailing zeros.
Does Intl.NumberFormat support the Indian lakh and crore system?
Yes. The hi-IN locale implements the Indian numbering system natively: groups of two digits after the first three, producing ₹12,50,500.75 for 1,250,500.75. No custom logic is needed — it is part of the Unicode CLDR standard that browsers implement. The tool shows the Indian format in the blue highlight box below the code snippet.
What is the difference between the percent style and just multiplying by 100?
Intl.NumberFormat with style: 'percent' treats the input as a fraction, not a whole percentage — it multiplies the value by 100 internally. Pass 0.45 to get "45%", not 45. If your value is already stored as a percentage (like 45), divide it by 100 before formatting: formatter.format(45 / 100). The tool shows a note about this when you switch to the Percent style.
How do I format numbers for different countries without changing the currency?
Use the Locale dropdown in the Technical Configuration panel to override the display locale independently from the currency code. For example, you can display a BRL amount using en-US locale conventions to get R$1,250,500.75 instead of R$ 1.250.500,75. This is useful when exporting data for international audiences while keeping your source currency.
Resources
- MDN — Intl.NumberFormat — Official reference for all constructor options, supported locales, and browser compatibility table.
- ECMAScript Internationalization API Specification — The TC39 spec that defines exactly how
Intl.NumberFormatmust behave across all compliant JavaScript engines. - Unicode CLDR — Number Formats — The underlying data that browsers use for locale-specific grouping, decimal separators, and currency symbols.