npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

n2words

v4.0.0

Published

Convert numbers to words in 71 languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.

Downloads

72,757

Readme

n2words

CI Coverage npm version npm provenance npm downloads jsDelivr

Numbers to words. 71 languages. Zero dependencies.

Why n2words?

  • Pure Functions — Each language exports standalone functions. No classes, no configuration, no side effects.
  • Tree-Shakeable — Import only what you need. Unused exports are eliminated by modern bundlers.
  • Tiny Bundles — ~2.4 KB gzipped per language (with all forms). No bloat.
  • Multiple Forms — Cardinal ("forty-two"), ordinal ("forty-second"), and currency ("forty-two dollars")
  • 71 Languages — European, Asian, Middle Eastern, African, and regional variants
  • Zero Dependencies — Works everywhere: Node.js, browsers, Deno, Bun
  • BigInt Support — Handle arbitrarily large numbers without precision loss
  • Type-Safe — Full TypeScript support with generated .d.ts declarations

Quick Start

npm install n2words
import { toCardinal } from 'n2words/en-US'
import { toCardinal as es } from 'n2words/es-ES'

toCardinal(42)   // 'forty-two'
es(42)           // 'cuarenta y dos'

Forms

n2words converts numbers to words in multiple forms:

| Form | Function | Example | | -------- | -------------------- | ----------------------------------- | | Cardinal | toCardinal(42) | "forty-two" | | Ordinal | toOrdinal(42) | "forty-second" | | Currency | toCurrency(42.50) | "forty-two dollars and fifty cents" |

import { toCardinal, toOrdinal, toCurrency } from 'n2words/en-US'

toCardinal(1234)      // 'one thousand two hundred thirty-four'
toOrdinal(1234)       // 'one thousand two hundred thirty-fourth'
toCurrency(1234.56)   // 'one thousand two hundred thirty-four dollars and fifty-six cents'

All 71 languages support all three forms. See LANGUAGES.md for details.

Usage

ESM (Node.js, modern bundlers):

import { toCardinal } from 'n2words/en-US'            // Single form
import { toCardinal, toOrdinal } from 'n2words/en-US' // Multiple forms
import { toCardinal as fr } from 'n2words/fr-FR'       // Aliased import

Browser (CDN):

<!-- ESM (recommended) -->
<script type="module">
  import { toCardinal } from 'https://cdn.jsdelivr.net/npm/n2words/dist/en-US.js'
  console.log(toCardinal(42))  // 'forty-two'
</script>

<!-- UMD (legacy script tags) -->
<script src="https://cdn.jsdelivr.net/npm/n2words/dist/en-US.umd.js"></script>
<script>
  n2words.enUS(42)              // 'forty-two'
  n2words.ordinal.enUS(42)      // 'forty-second'
  n2words.currency.enUS(42.50)  // 'forty-two dollars and fifty cents'
</script>

See LANGUAGES.md for all language codes and available forms.

Supported Languages (71)

See LANGUAGES.md for the complete list with codes and options.

Highlights: Arabic, Chinese (Simplified/Traditional), English, French, German, Hindi, Japanese, Korean, Portuguese, Russian, Spanish, and 60 more.

Compatibility

  • Node.js: 20+
  • Browsers: Chrome 67+, Firefox 68+, Safari 14+, Edge 79+ (~87% global coverage)
  • Runtimes: Deno, Bun, Cloudflare Workers

Requires BigInt support (cannot be polyfilled).

Performance

n2words is optimized for both size and speed:

  • ~2.4 KB gzipped per language (includes all forms)
  • Individual language imports enable tree-shaking
  • No runtime dependencies
  • BigInt modulo operations (no string manipulation)
  • Pure functions with no shared state
  • Minimal memory allocation per conversion

Run npm run bench to measure on your hardware.

Contributing

We welcome contributions! Add a new language or improve existing ones:

npm run lang:add <code>    # Scaffold a new language (BCP 47 code)
npm test                   # Run full test suite

Also welcome: bug reports, feature requests, and documentation improvements.

License

MIT © Wael TELLAT, Tyler Vigario & contributors