Number to Words Converter: how it works and how to build one
Write numbers in words, in lakh/crore or million style. This guide explains what happens behind the button and shows the code, so you can build your own.
What it does
Converts numbers to words in the Indian system (lakh, crore) or the international system (million, billion). Cheque style writes ‘… rupees and fifty paise only’. Paste many numbers, one per line.
When to use it
- Writing cheques and invoices
- Legal documents
- Accessibility (reading numbers aloud)
How to use it
- Paste numbers, one per line.
- Pick the system, style and case.
- Copy the words.
Try it free in your browser, nothing is uploaded: https://eskillsfy.com/tools/number-to-words
How it works
Numbers are read in groups. Every number below 1,000 is built from ‘ones’, ‘tens’ and ‘hundred’. The international system then groups by thousands (thousand, million, billion), while the Indian system uses thousand, lakh (1,00,000) and crore (1,00,00,000).
BigInt keeps large numbers exact. Currency mode adds ‘rupees … paise only’, the wording used on cheques.
Build it yourself
Here is the core of the tool. It has no dependencies unless noted, so you can paste it into any TypeScript or JavaScript project.
numberToWords.ts (ts)
const ONES = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"];
const TENS = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"];
const two = (n: number) => (n < 20 ? ONES[n] : TENS[Math.floor(n / 10)] + (n % 10 ? "-" + ONES[n % 10] : ""));
const three = (n: number) => (n >= 100 ? `${ONES[Math.floor(n / 100)]} hundred${n % 100 ? " " + two(n % 100) : ""}` : two(n));
export function indianWords(n: number): string {
if (n === 0) return "zero";
const parts: string[] = [];
for (const [v, name] of [[1e7, "crore"], [1e5, "lakh"], [1e3, "thousand"]] as const) {
if (n >= v) { parts.push(`${indianWords(Math.floor(n / v))} ${name}`); n %= v; }
}
if (n) parts.push(three(n));
return parts.join(" ");
}
indianWords(1250000); // "twelve lakh fifty thousand"
Make it production-ready
- Add the international system (million, billion).
- Add paise/cents after the decimal point.
Questions
Can I write a cheque amount?
Yes. Pick Cheque / currency and Indian to get ‘Twelve lakh fifty thousand rupees only’.
Free, runs in your browser, nothing is uploaded.