The most complete number-to-words library for JavaScript and TypeScript. 132 locales, currency, ordinal, BigInt, ESM/CJS/UMD — single package, zero dependencies.
npm install to-wordsto-words/en-US| Metric | to-words | number-to-words | written-number | num-words | n2words |
|---|---|---|---|---|---|
| Latest npm version | 5.6.0 | 1.2.4 | 0.11.1 | 1.2.3 | 5.0.0 |
| Last publish (UTC) | 2026-05-27 | 2018-08-09 | 2021-07-12 | 2023-02-21 | 2026-05-30 |
| npm downloads (last week) | 111,476 | 492,316 | 53,011 | 6,319 | 24,404 |
| Language/locale coverage claim | 132 locales | English-focused | Multi-language | Indian English | 70+ languages |
| TypeScript declarations | ✅ | ❌ | ❌ | ✅ | ✅ |
| BigInt support | ✅ | ❌ | ❌ | ❌ | ✅ |
| Currency conversion | ✅ | ❌ | ❌ | ❌ | ✅ |
| Ordinal output | ✅ | ✅ | ❌ | ❌ | ✅ |
| Subpath locale imports | ✅ | ❌ | ❌ | ❌ | ✅ |
Snapshot verified on 2026-05-30 from published package metadata, package exports, and npm downloads API.
Reusable class for repeated conversions at one locale:
import { ToWords } from 'to-words';
const tw = new ToWords({ localeCode: 'en-US' });
tw.convert(12345);
tw.convert(1234.56, { currency: true });
tw.toOrdinal(3);Full-bundle helpers when locale changes at runtime:
import { detectLocale, toCurrency } from 'to-words';
const locale = detectLocale('en-US');
toCurrency(452.36, { localeCode: locale });Per-locale imports when bundle size matters:
import { toWords, toCurrency } from 'to-words/hi-IN';
toWords(12345);
toCurrency(452.36);import { ToWords } from 'to-words';
const tw = new ToWords({ localeCode: 'en-US' });
tw.convert(12345); // "Twelve Thousand Three Hundred Forty Five"
tw.convert(1234.56, { currency: true }); // "One Thousand Two Hundred Thirty Four Dollars And Fifty Six Cents Only"
tw.toOrdinal(3); // "Third"Or use the functional API (one-liner, auto locale detection):
import { toWords, toCurrency, toOrdinal } from 'to-words';
toWords(12345, { localeCode: 'hi-IN' }); // "बारह हजार तीन सौ पैंतालीस"
toCurrency(452.36, { localeCode: 'hi-IN' }); // "चार सौ बावन रुपये और छत्तीस पैसे"| Need | What to use |
|---|---|
| Runtime locale switching | toWords() / toCurrency() with localeCode |
| Minimal frontend bundle | to-words/<locale> imports |
| Fraction-style decimals | decimalStyle: 'fraction' |
| Gender-aware output | gender: 'feminine' or gender: 'masculine' |
| Anti-fraud Chinese numerals | formal: true |
| Server locale from headers | setLocaleDetector() |
See dedicated walkthroughs for invoicing, cheque printing, text-to-speech, payroll, e-commerce checkout, and legal documents.
These are dedicated locale guide pages, listed alphabetically by language name for predictable scanning.