Skip to content
gohacks.dev
Standard Library

Number Formatter

Format a number in 17 locales as plain, currency, compact and percent, and parse a localised number such as 1.234.567,89 back to a plain value.

Free · No sign-up · Your inputs stay in your browser

Input

Format numbers for any locale

Output

Formatted

Formatting...

As a plain number

Produced by the browser's Intl.NumberFormat, the same CLDR data PHP's NumberFormatter (intl) and ICU use, so output matches across languages. Separators differ more than people expect: 1.234,5 in Germany, 1 234,5 with a narrow space in France, 12,34,567 grouping in India, and the currency symbol moves. Store numbers raw and format only on display.

Runs in this browser. Nothing you paste is sent to a server.

Separators differ more than expected

One million and a quarter is 1,000,000.25 in the US, 1.000.000,25 in Germany, 1 000 000,25 with a narrow no-break space in France and 10,00,000.25 in India, where digits group in twos after the first three. The currency symbol moves before or after the number. Formatting rules live in the Unicode CLDR data that browsers, ICU and PHP's intl extension share.

Store raw, format late

Keep numbers as numbers (or integer cents) in storage and APIs, and format only when displaying, in the reader's locale. Parsing user input needs the user's locale too, or 1.234 means one thousand in one country and one point two in another.

Share

Frequently asked questions

How do I format a number in PHP for a locale?
With the intl extension: (new NumberFormatter('de_DE', NumberFormatter::DECIMAL))->format($n), or CURRENCY with formatCurrency().
Why does French formatting show an odd space?
French uses a narrow no-break space (U+202F) as the group separator, so numbers never wrap across lines.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools