
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
word-number-word
Advanced tools
A TypeScript/JavaScript utility for converting numbers to words and vice versa — including support for decimals, negatives, and currency converting.
Convert numbers to words and words back to numbers — now with support for currency. Simple, accurate, and type-safe. Works seamlessly with JavaScript, TypeScript, Node.js, React, Next.js, and even from the CLI.
42 → "forty-two""seven point five" → 7.510.25 ↔️ "ten dollars and twenty-five cents")npm install word-number-word
# or
yarn add word-number-word
import {
numberToWord,
wordToNumber,
currencyToWord,
wordToCurrency,
} from "word-number-word";
// Basic usage
console.log(numberToWord(42)); // "forty-two"
console.log(wordToNumber("minus three")); // -3
// Currency support
console.log(currencyToWord(10.25, "usd")); // "ten dollars and twenty-five cents"
console.log(wordToCurrency("ten dollars and five cents", "usd")); // 10.05
npx word-number-word 123
# Output: "one hundred twenty-three"
npx word-number-word "two thousand and five"
# Output: 2005
| Function | Description | Example |
|---|---|---|
numberToWord(num: number) | Converts a number to its word form | numberToWord(123) → "one hundred twenty-three" |
wordToNumber(str: string) | Converts a word string into a number | wordToNumber("five") → 5 |
currencyToWord(num: number, currency) | Converts currency number to words (with major/minor units) | currencyToWord(4.5, "usd") → "four dollars and fifty cents" |
wordToCurrency(str, currency) | Converts word form currency to number | wordToCurrency("ten dollars and five cents", "usd") → 10.05 |
Note: Currency codes supported
"usd","bdt","eur","gbp". Handles both"forty-two"and"forty two"formats.
npx or install globally)| Input | Output |
|---|---|
123 | "one hundred twenty-three" |
-99.5 | "minus ninety-nine point five" |
"fourteen" | 14 |
"minus two" | -2 |
"three point one four" | 3.14 |
currencyToWord(4.5, "usd") | "four dollars and fifty cents" |
wordToCurrency("ten dollars and five cents", "usd") | 10.05 |
Install globally for quick conversions in your terminal:
npm install -g word-number-word
Then use it anywhere:
word-number-word 456
# → "four hundred fifty-six"
MIT License © Hridoy Saha
Contributions, suggestions, and improvements are welcome!
Feel free to open an issue or submit a pull request.
FAQs
A TypeScript/JavaScript utility for converting numbers to words and vice versa — including support for decimals, negatives, and currency converting.
The npm package word-number-word receives a total of 20 weekly downloads. As such, word-number-word popularity was classified as not popular.
We found that word-number-word demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.