Skip to content
Generate now

How to Format Currency in Apps: Codes, Symbols, Decimals

Displaying a price looks trivial until your app goes international. Suddenly yen has no cents, a Kuwaiti dinar has three decimal places, the euro sign appears after the number in Paris, and a dollar sign could mean five different currencies. Money bugs are expensive and embarrassing. This guide covers the rules that matter when storing, calculating and formatting currency, and shows how random currencies help you test the edge cases.

Options

Tip: press Enter or Space to generate again.

Ready

Use ISO 4217 codes as your source of truth

Every currency has a three-letter ISO 4217 code, usually built from the countryโ€™s two-letter code plus a letter for the currency: USD, GBP, JPY, CHF. Each also has a three-digit numeric code, such as 840 for the US dollar and 978 for the euro.

Store the code with every amount. Symbols are for display only: the $ sign is shared by several currencies, and ยฅ is used for both the Japanese yen and the Chinese yuan. An amount without a currency code is a bug waiting to happen.

Not every currency has two decimal places

ISO 4217 also defines each currencyโ€™s minor unit โ€” how many decimal places it normally uses:

  • 0 decimals: Japanese yen (JPY) and South Korean won (KRW).
  • 2 decimals: most currencies, including USD, EUR and GBP.
  • 3 decimals: Kuwaiti dinar (KWD), Bahraini dinar (BHD) and Omani rial (OMR).

Hard-coding two decimals will show โ€œยฅ1,500.00,โ€ which looks wrong to Japanese users, and will round away a real digit for dinar amounts.

Never store money as floating-point numbers

Binary floating-point numbers cannot represent most decimal fractions exactly. In many languages 0.1 + 0.2 produces 0.30000000000000004, and small errors like this accumulate in totals, taxes and refunds. Safer options:

  • Store amounts as integers in the minor unit: 1999 cents for 19.99 USD, 1500 for 1,500 JPY.
  • Or use a dedicated decimal type in your database and language.
  • Round only at defined points, such as per line item or per invoice, and document the rule.

Let the locale handle symbols and separators

The same amount looks different around the world:

  • English (United States): โ‚ฌ1,234.56
  • German (Germany): 1.234,56 โ‚ฌ
  • French (France): 1 234,56 โ‚ฌ, with a narrow space as the group separator

Notice that the format depends on the readerโ€™s locale, not on the currency. Modern platforms provide locale-aware formatters โ€” in JavaScript, Intl.NumberFormat with the currency style handles symbol position, separators and decimal places for you. Avoid building the string by hand.

Generate test currencies with RandNow

The Random Currency Generator above draws from a list of 46 currencies:

  1. Set How many? anywhere from 1 to 46.
  2. Press Generate. Each result shows the code, symbol and full name, such as KRW โ‚ฉ (South Korean won) or VND โ‚ซ (Vietnamese ฤ‘แป“ng).
  3. Export the list as CSV, JSON or TXT and use it to drive price display tests, spreadsheets or flashcards.

Picks are independent, so a batch may repeat a currency. The tool shows codes and symbols only โ€” it does not provide exchange rates. Random decimal amounts complete the test set:

A currency test checklist

  • Display a zero-decimal currency (JPY) and a three-decimal currency (KWD).
  • Show the same amount in English, German and French locales.
  • Check two currencies that share a symbol on the same screen.
  • Total a cart of many small amounts and compare with an exact decimal result.
  • Test very large amounts and negative values such as refunds.

Do not forget input

Formatting output is only half the job. When users type an amount, people in Germany may enter a comma as the decimal separator, while people in the United States use a period. Accept both where it is unambiguous, show the parsed value back to the user before they confirm a payment, and reject amounts with more decimal places than the currency allows. Clear feedback at this step prevents far more support tickets than clever parsing rules.

Pro tips

  • Always store a currency code next to every amount.
  • Use integer minor units or a decimal type โ€” never floats โ€” for money.
  • Format with a locale-aware library instead of string concatenation.
  • Show the code, not just the symbol, when several dollar currencies may appear.

Frequently asked questions

Should prices show the symbol or the code?

Symbols are friendlier for a single local currency. When several currencies appear together, or a symbol is shared, showing the code avoids confusion.

Does the currency decide the number format?

No. The readerโ€™s locale decides separators and symbol position, while the currency decides the symbol and the usual number of decimal places.

How should I convert between currencies?

Use exchange rates from a reliable, current source, record the rate and time used, and round the converted amount to the target currencyโ€™s minor unit.

Try a generator

Random Address Generator

Realistic street addresses with valid-format postal codes and phone numbers for 40 countries.

Fake Identity Generator

Complete fictional person profiles: name, birthday, address, phone, email, job and more.

Need random data? Get it now.

Pick any of 144 generators, hit Generate and copy or export the results as CSV, JSON or TXT. No account, no limits, nothing stored.

Start generating โ€” free