Skip to content

Convert Numbers to Words in JavaScript

The most complete number-to-words library for JavaScript and TypeScript. 132 locales, currency, ordinal, BigInt, ESM/CJS/UMD — single package, zero dependencies.

bash
npm install to-words
Loading…
📝 1 words🔤 8 charactersen-US

Quick Examples

🌍 132 Locales⚡ 4M+ ops/sec📦 ~3 KB gzip🔷 TypeScript

Built For Real Product Work

  • Convert invoice totals, cheques, payout slips, and receipts into legally readable text
  • Support Indian, European long-scale, East Asian, and short-scale numbering from one package
  • Keep frontend bundles small with per-locale imports such as to-words/en-US
  • Use the same API across React, Vue, Next.js, Node.js, and CLI workflows

Why to-words?

Metricto-wordsnumber-to-wordswritten-numbernum-wordsn2words
Latest npm version5.6.01.2.40.11.11.2.35.0.0
Last publish (UTC)2026-05-272018-08-092021-07-122023-02-212026-05-30
npm downloads (last week)111,476492,31653,0116,31924,404
Language/locale coverage claim132 localesEnglish-focusedMulti-languageIndian English70+ 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.

Three Integration Patterns

Reusable class for repeated conversions at one locale:

js
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:

js
import { detectLocale, toCurrency } from 'to-words';

const locale = detectLocale('en-US');
toCurrency(452.36, { localeCode: locale });

Per-locale imports when bundle size matters:

js
import { toWords, toCurrency } from 'to-words/hi-IN';

toWords(12345);
toCurrency(452.36);

Quick Start

js
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):

js
import { toWords, toCurrency, toOrdinal } from 'to-words';

toWords(12345, { localeCode: 'hi-IN' }); // "बारह हजार तीन सौ पैंतालीस"
toCurrency(452.36, { localeCode: 'hi-IN' }); // "चार सौ बावन रुपये और छत्तीस पैसे"

Feature Highlights

NeedWhat to use
Runtime locale switchingtoWords() / toCurrency() with localeCode
Minimal frontend bundleto-words/<locale> imports
Fraction-style decimalsdecimalStyle: 'fraction'
Gender-aware outputgender: 'feminine' or gender: 'masculine'
Anti-fraud Chinese numeralsformal: true
Server locale from headerssetLocaleDetector()

Use Cases

  • Invoicing & Billing — print totals in words on PDF invoices across 132 countries
  • Cheque Printing — banks require amounts in words; locale currency wording keeps major and minor unit names aligned
  • Text-to-Speech — feed clean word strings to TTS engines in 132 languages
  • Payroll & Payslips — generate salary slip amounts in words across regions
  • E-commerce Checkout — reduce ambiguity on high-value order confirmations
  • Legal Documents — contracts that require spelled-out numbers
  • Education — number learning in native scripts (Devanagari, Arabic, CJK, Cyrillic…)

See dedicated walkthroughs for invoicing, cheque printing, text-to-speech, payroll, e-commerce checkout, and legal documents.

Locale Guide Shortcuts

These are dedicated locale guide pages, listed alphabetically by language name for predictable scanning.

See all 132 locales

Start Here Next

Released under the MIT License.