Development

Number Formatting

Displaying numbers according to locale-specific conventions.

Definition

Number formatting varies by locale: decimal separators (. vs ,), thousand separators (. vs , vs space), digit grouping, and more. Currency formatting adds symbol position and spacing. The JavaScript Intl.NumberFormat API handles locale-aware number and currency formatting automatically. Proper number formatting prevents confusion and errors in financial and data applications.

Examples

  • US: 1,234.56
  • Germany: 1.234,56
  • France: 1 234,56 (space separator)
  • Currency: $1,234.56 (US) vs 1.234,56 € (Germany)

Frequently Asked Questions

How do I format currency correctly?

Use Intl.NumberFormat with style: 'currency' and currency code. Example: new Intl.NumberFormat('de-DE', {style: 'currency', currency: 'EUR'}).format(1234.56) → '1.234,56 €'. Always specify currency code, not just locale.

Should I store formatted or raw numbers?

Always store raw numbers (1234.56 as Number or Decimal). Format only for display. Never store formatted strings—you lose precision and can't reformat for other locales. Parse user input to raw numbers immediately.

Related Terms

Ready to simplify your i18n workflow?

Start managing translations with IntlPull.

    Number Formatting - Definition & Examples | IntlPull Glossary | IntlPull