Converting numbers to Indian currency using JavaScript

Converting numbers to Indian currency format is a common requirement in web applications. JavaScript provides a built-in method to format numbers according to different locales, including the Indian numbering system.

Understanding Indian Currency Format

Indian currency uses a unique grouping system where numbers are grouped by hundreds (lakhs and crores) rather than thousands. For example:

1000 ? ?1,000.00
129943 ? ?1,29,943.00
76768798 ? ?7,67,68,798.00

Using toLocaleString() Method

The toLocaleString() method with Indian locale ('en-IN') automatically handles the currency formatting:

const num1 = 1000;
const num2 = 129943;
const num3 = 76768798;

const toIndianCurrency = (num) => {
    const curr = num.toLocaleString('en-IN', {
        style: 'currency',
        currency: 'INR'
    });
    return curr;
};

console.log(toIndianCurrency(num1));
console.log(toIndianCurrency(num2));
console.log(toIndianCurrency(num3));
?1,000.00
?1,29,943.00
?7,67,68,798.00

Parameters Explained

The toLocaleString() method accepts two parameters:

  • 'en-IN' - Indian English locale for proper number grouping
  • options object - Contains style and currency properties

Alternative: Without Decimal Places

To display currency without decimal places, use the minimumFractionDigits option:

const toIndianCurrencyNoDecimals = (num) => {
    return num.toLocaleString('en-IN', {
        style: 'currency',
        currency: 'INR',
        minimumFractionDigits: 0
    });
};

console.log(toIndianCurrencyNoDecimals(1000));
console.log(toIndianCurrencyNoDecimals(129943));
console.log(toIndianCurrencyNoDecimals(76768798));
?1,000
?1,29,943
?7,67,68,798

Handling Edge Cases

The function also handles negative numbers and floating-point values correctly:

console.log(toIndianCurrency(-5000));
console.log(toIndianCurrency(1234.56));
console.log(toIndianCurrency(0));
-?5,000.00
?1,234.56
?0.00

Conclusion

JavaScript's toLocaleString() method with 'en-IN' locale provides an efficient way to format numbers as Indian currency. This built-in solution handles the unique Indian numbering system automatically without requiring complex manual formatting.

Updated on: 2026-03-15T23:19:00+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements