Skip to content

didrod205/spellnum

🔢 spellnum

Turn numbers and money amounts into words — English & Korean. Locally.

npm version bundle size CI types license

🌐 Try the free web app →  ·  type a number, get the words. English & 한국어.


Invoices, cheques and contracts ask you to write the amount in words — "one thousand two hundred thirty-four dollars and fifty-six cents", or "백이십삼만 사천원". Doing it by hand is slow and error-prone, especially in Korean, where digits group by 만/억/조 (every 4 places) instead of every 3.

spellnum does it exactly and instantly — English and Korean, numbers and currency — with BigInt precision, zero dependencies, and 100% locally.

📸 Screenshot / demo GIF: ./web/screenshot.png — record the live app typing an amount and toggling English / 한국어 / money.

Why it exists

  • AI can't reliably do this. Spelling large numbers — and Korean's myriad (만/억/조) grouping in particular — follows exact rules that language models routinely get wrong. When the words must match the figures (legal/financial documents), you need a deterministic tool, not a guess.
  • Precision. The integer part uses BigInt, so it's exact even past what a JavaScript number can hold.
  • It's everywhere, quietly. Invoicing, cheque writing, contracts, receipts, number education, and screen-reader-friendly text all need numbers as words.

Who it's for

Freelancers & small businesses (invoices/receipts), finance & ops (cheques, contracts), creators selling products/services, educators, and developers localizing apps or building accessible UIs.

Install

No install — just open the web app.

Command line:

npx spellnum 1234                                  # one thousand two hundred thirty-four
npx spellnum 1230000 --ko --currency KRW --formal  # 금일백이십삼만원정

Library:

npm install spellnum

Zero dependencies. ESM + CJS + TypeScript types. Runs in the browser, Node, Deno and Bun.

CLI

spellnum <number> [options]
echo 42 | spellnum --ko        # also works as a filter
Option Description
--ko / --en Korean (만/억/조) or English (default)
--currency <code> Money words: USD, EUR, GBP, KRW, JPY…
--formal Korean anti-fraud format 금…원정 (갖은자). KRW only
--ordinal English ordinal (21twenty-first)
--and British "one hundred and one"
--cents <words|fraction> Minor-unit rendering
$ spellnum 1234.56 --currency USD
one thousand two hundred thirty-four dollars and fifty-six cents

$ spellnum 1230000 --ko --currency KRW --formal
금일백이십삼만원정

Usage

import { toWords, toCurrencyWords, toOrdinalWords, toFormalKoreanAmount } from "spellnum";

// Numbers
toWords(1234);                       // "one thousand two hundred thirty-four"
toWords(3.14);                       // "three point one four"
toWords(123, { and: true });         // "one hundred and twenty-three"

// Korean (만/억/조 grouping)
toWords(12345678, { lang: "ko" });   // "천이백삼십사만오천육백칠십팔"
toWords(10000, { lang: "ko" });      // "일만"

// Money
toCurrencyWords(1234.56);                          // "…dollars and fifty-six cents"
toCurrencyWords(99.5, { cents: "fraction" });      // "ninety-nine dollars and 50/100"
toCurrencyWords(1234000, { currency: "KRW" });     // "백이십삼만사천원"
toCurrencyWords(1.01, { currency: "GBP" });        // "one pound and one penny"

// Korean formal / anti-fraud (contracts, cheques, tax invoices)
toCurrencyWords(1230000, { currency: "KRW", formal: true }); // "금일백이십삼만원정"
toFormalKoreanAmount(50000n);                                // "금오만원정"
toWords(100, { lang: "ko", formal: true });                  // "일백" (leading 일 kept)

// Ordinals (English)
toOrdinalWords(21n);                 // "twenty-first"

Why a formal Korean mode? On Korean contracts, cheques (수표) and tax invoices, amounts are written as 금…원정 with the leading kept (일백, 일천) so a figure can't be altered after signing. spellnum is the rare number-to-words tool that produces this legally-recognized format.

Exactness with BigInt

toWords("1000000000000000000000"); // "one sextillion" (way past Number's safe range)
toWords(12345678901234567890n);    // exact

API

Function Description
toWords(value, { lang?, and?, negativeWord? }) Number → words (en/ko).
toCurrencyWords(amount, { currency?, lang?, cents? }) Money → words.
toOrdinalWords(bigint) English ordinal words (first, twenty-first).
bigIntToWordsEN / bigIntToWordsKO Low-level integer converters.
CURRENCIES Supported currency definitions.

value accepts a number, bigint, or numeric string (use a string/bigint for very large or high-precision values).

FAQ

Which languages are supported? English and Korean today. The architecture is per-language, so more can be added (see CONTRIBUTING).

Why Korean specifically? Korean groups digits by 만/억/조 (every 4 places), which is exactly the rule that generic tools and LLMs get wrong — and writing amounts in Korean words is common on invoices and contracts.

Is anything sent to a server? No. It runs entirely on your device — no server, no telemetry, works offline.

Does it handle decimals and money? Yes — toWords spells decimals digit-by-digit ("point one four"), and toCurrencyWords formats amounts with major/minor units (or cheque-style 56/100).

How big a number can it handle? The integer part uses BigInt, so it's exact up to "decillion"-scale names (extend SCALES/BIG for more).

Contributing

Contributions welcome! See CONTRIBUTING.md and the Code of Conduct.

git clone https://github.com/didrod205/spellnum.git
cd spellnum
npm install
npm test          # run the suite
npm run dev       # run the web app locally

💖 Sponsor

spellnum is free, MIT-licensed, and built in spare time. If it saved you from hand-writing "amount in words", please consider supporting it:

  • Star this repo — free, and it genuinely helps others find it.
  • 🍋 Sponsor via Lemon Squeezy — one-time or recurring support.

Where your support goes: more languages (Japanese, Chinese, Spanish, Hindi…), more currencies, ordinals & fractions per language, a native Korean (하나·둘) mode, keeping the free web app online, and fast issue responses.

License

MIT © spellnum contributors

About

Convert numbers & money amounts to words — English & Korean (만/억/조). For invoices, cheques, contracts. Exact (BigInt), zero deps. Web app + library.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors