Compact Number Notation (1K, 1M, 1B) with Intl.NumberFormat

Format large numbers as compact abbreviations like 1K, 1M, 1B for any locale using Intl.NumberFormat compact notation. Learn about short vs long display and locale-specific abbreviations.

Intl.NumberFormat

Detailed Explanation

Compact Number Notation

Compact notation abbreviates large numbers into shorter, more readable forms. This is common in social media (1.2K likes), dashboards (3.5M revenue), and analytics.

Basic Compact Formatting

const short = { notation: 'compact', compactDisplay: 'short' };
const long = { notation: 'compact', compactDisplay: 'long' };

new Intl.NumberFormat('en-US', short).format(1500);
// "1.5K"
new Intl.NumberFormat('en-US', long).format(1500);
// "1.5 thousand"

new Intl.NumberFormat('en-US', short).format(1500000);
// "1.5M"
new Intl.NumberFormat('en-US', long).format(1500000);
// "1.5 million"

new Intl.NumberFormat('en-US', short).format(1500000000);
// "1.5B"

Locale-Specific Abbreviations

const n = 1500000;

new Intl.NumberFormat('en', { notation: 'compact' }).format(n);
// "1.5M"

new Intl.NumberFormat('ja', { notation: 'compact' }).format(n);
// "150万" (150 man = 1.5 million)

new Intl.NumberFormat('ko', { notation: 'compact' }).format(n);
// "150만"

new Intl.NumberFormat('zh', { notation: 'compact' }).format(n);
// "150万"

new Intl.NumberFormat('de', { notation: 'compact' }).format(n);
// "1,5 Mio."

new Intl.NumberFormat('hi', { notation: 'compact' }).format(n);
// "15 लाख"

East Asian 10,000-Based System

Japanese, Chinese, and Korean use 万 (10,000) as a base unit:

Number English Japanese Chinese
10,000 10K 1万 1万
100,000 100K 10万 10万
1,000,000 1M 100万 100万
100,000,000 100M 1億 1亿

Controlling Precision

new Intl.NumberFormat('en', {
  notation: 'compact',
  maximumFractionDigits: 0,
}).format(1567);  // "2K"

new Intl.NumberFormat('en', {
  notation: 'compact',
  maximumFractionDigits: 2,
}).format(1567);  // "1.57K"

new Intl.NumberFormat('en', {
  notation: 'compact',
  maximumSignificantDigits: 3,
}).format(1567000);  // "1.57M"

Combining with Currency

new Intl.NumberFormat('en-US', {
  style: 'currency',
  currency: 'USD',
  notation: 'compact',
}).format(5600000);  // "$5.6M"

Use Case

Compact notation is essential for dashboards, social media metrics, financial summaries, and any UI that needs to display large numbers in limited space. A social media app shows '1.2K followers' instead of '1,234 followers'. A revenue dashboard displays '$3.5M' instead of '$3,500,000'. Using Intl.NumberFormat ensures these abbreviations use the correct locale conventions -- Japanese users expect '万' units, Indian users expect 'lakh' and 'crore', and German users expect 'Mio.' and 'Mrd.'.

Try It — Locale String Tester

Open full tool