Guide
Formatting numbers for people, locales and currencies
By Logappradeep · ServiceNow developer
Computers store numbers as raw values like 1234567890.45, but people read them more easily with grouping separators, currency symbols or abbreviations. The right format depends on the audience: an Indian invoice, a US dashboard and a scientific paper would each write the same value differently. This tool shows a number in five common formats side by side.
The five formats
For the input 1234567890.45:
- International (US):
1,234,567,890.45. Digits are grouped in threes with commas, and a period marks the decimal. - Indian (lakhs and crores):
1,23,45,67,890.45. The first group has three digits, and each group after that has two. One lakh is 1,00,000 (one hundred thousand) and one crore is 1,00,00,000 (ten million), so this value reads as about 123 crore. - Currency (USD):
$1,234,567,890.45, rounded to two decimal places as cents. - Compact:
1.2B, the short form used in dashboards and social media counts. - Scientific notation:
1.2346e+9, meaning 1.2346 × 10⁹, shown with four digits after the decimal point.
The formatting uses the browser's built-in Intl.NumberFormat API with the en-US and en-IN locales, the same API you can call in your own JavaScript.
Where each format fits
- Use locale grouping for tables, invoices and reports where exact values matter.
- Use the Indian system for audiences in India, Pakistan, Bangladesh and Nepal, where lakh and crore are standard in finance and media.
- Use compact notation for KPIs and follower counts where scale matters more than precision.
- Use scientific notation for very large or very small measurements in engineering and science.
Pitfalls
Separators depend on the locale. Germany writes 1.234.567,89, with the comma and period swapped, and French uses a narrow space for grouping. Never hard-code commas; format with the user's locale.
Never parse formatted strings back. Store and calculate with raw numbers, and format only for display. Turning "1,234.50" back into a number is error-prone across locales.
Formatting is not conversion. The currency view adds a dollar sign and rounds to cents; it does not convert from another currency.
Floating-point precision. JavaScript numbers are binary floating point, so 0.1 + 0.2 is 0.30000000000000004, and integers are exact only up to 9,007,199,254,740,991. For money, calculate in the smallest unit (cents or paise) as integers, or use a decimal library.
Compact notation hides detail. 1.2B could be anything from 1.15 to 1.25 billion. Show the exact value in a tooltip or table where it matters. "Billion" also means 10⁹ in modern English, but some languages use "milliard" for 10⁹ and "billion" for 10¹².
All formatting runs in your browser, and the last number you entered is remembered.