Skip to content
Sarah DayanSarah Dayan

TypeScript

dinerojs/dinero.js

Create, calculate, and format money in TypeScript.

6,717stars

See on GitHub (opens in new tab)

Dinero.js is a JavaScript library for creating, calculating, and formatting money. I built it in 2018 at a fintech startup where I kept running into the same problem: JavaScript has no native way to safely represent money. Dinero.js fixes this by representing amounts as integers in minor units, paired with a currency object.

In March 2026, after years of development and a dozen alpha releases, I shipped v2 stable, a complete rewrite replacing the chainable OOP API with standalone, tree-shakable functions.

Key features

  • Immutable and type-safe: every operation returns a new object, with full TypeScript inference
  • Functional API: standalone, tree-shakable functions instead of chainable methods
  • Pluggable precision: number by default, bigint for large or high-precision amounts
  • Non-decimal currencies: works with any base, including multi-subdivision currencies
  • 168 ISO 4217 currencies: typed objects with code, base, and exponent
  • Zero dependencies: lightweight and framework-agnostic

My involvement

I created and maintain Dinero.js, having built both v1 and the ground-up v2 rewrite. The library is used by WooCommerce, Cypress, Vercel, Highlight, and AWS Labs, among others.