Convert numbers into written words in English and Spanish.
A tiny and fast TypeScript/JavaScript library to translate numbers into natural language.
- Supports English and Spanish
- Handles numbers from
0up to999,999,999,999 - Supports negative numbers
- Strictly typed with TypeScript
- Compatible with JavaScript (
require/import) - Tiny footprint, no dependencies
npm install @easii/number-2-words
# or
yarn add @easii/number-2-wordsimport { toWords, Locale } from "@easii/number-2-words";
toWords(123, Locale.ENGLISH);
// -> "one hundred twenty-three"
toWords(123, Locale.SPANISH);
// -> "ciento veintitres"
toWords(-45, Locale.ENGLISH);
// -> "minus forty-five"
toWords(-45, Locale.SPANISH);
// -> "menos cuarenta y cinco"const { toWords, Locale } = require("@easii/number-2-words");
console.log(toWords(1000, Locale.ENGLISH)); // one thousand
console.log(toWords(-21, Locale.SPANISH)); // menos veintiunoimport { toWords, Locale } from "@easii/number-2-words";
console.log(toWords(42, Locale.ENGLISH)); // forty-two| Number | English | Spanish |
|---|---|---|
0 |
zero |
cero |
21 |
twenty-one |
veintiuno |
123 |
one hundred twenty-three |
ciento veintitres |
1000 |
one thousand |
mil |
1_000_000 |
one million |
un millon |
-532 |
minus five hundred thirty-two |
menos quinientos treinta y dos |
999_999_999_999 |
nine hundred ninety-nine billion nine hundred ninety-nine million nine hundred ninety-nine thousand nine hundred ninety-nine |
novecientos noventa y nueve mil novecientos noventa y nueve millones novecientos noventa y nueve mil novecientos noventa y nueve |
enum Locale {
ENGLISH = "en",
SPANISH = "es",
}More locales coming soon.
- English
- Spanish
- Negative numbers
- Decimal support
- Ordinals (
first,primero) - Currency formatting (
$123.45)
Feel free to fork the repository and submit pull requests.
MIT (c) 2025 - Rodrigo Peralta / Easii