Create, calculate, and format money in JavaScript and TypeScript
See the code
Dinero.js lets you create, calculate, and format money safely in JavaScript and TypeScript.
dinerojs.com
Money is complex, and the primitives of the language aren't enough to properly represent it. Dinero.js is a JavaScript library that lets you express monetary values, but also perform mutations, conversions, comparisons, formatting, and overall make money manipulation easier and safer in your application.
number by default or bigint for large amountsnpm install dinero.js
# or
yarn add dinero.js
Dinero objects are minimal. Every function in dinero.js is side-effect free, allowing you only to bundle exactly what you use.
import { dinero, add, toDecimal } from 'dinero.js';
import { USD } from 'dinero.js/currencies';
const d1 = dinero({ amount: 500, currency: USD });
const d2 = dinero({ amount: 800, currency: USD });
const total = add(d1, d2);
toDecimal(total); // "13.00"
Check out the quick start guide on the documentation.
The documentation lets you learn about all aspects of the library.
Visit the full documentation to know more.
If you use AI coding agents (Claude Code, Cursor, GitHub Copilot, etc.), install the Dinero.js skills to teach your agent best practices, common pitfalls, and correct usage patterns.
npx skills add dinerojs/skills
Dinero.js is used by WooCommerce, Highlight, Cypress, Vercel, AWS Labs, Module Federation, and many more.
Overall
Maintained
Code review
npm
Latest release
Releases this year
(top 24 of 39)
32,342 followers · starred Jun 2018
1,730 followers · starred Nov 2018
2,581 followers · starred Jul 2021
123 followers · starred Oct 2018
Create, calculate, and format money in JavaScript and TypeScript
See the code
Dinero.js lets you create, calculate, and format money safely in JavaScript and TypeScript.
dinerojs.com
Money is complex, and the primitives of the language aren't enough to properly represent it. Dinero.js is a JavaScript library that lets you express monetary values, but also perform mutations, conversions, comparisons, formatting, and overall make money manipulation easier and safer in your application.
number by default or bigint for large amountsnpm install dinero.js
# or
yarn add dinero.js
Dinero objects are minimal. Every function in dinero.js is side-effect free, allowing you only to bundle exactly what you use.
import { dinero, add, toDecimal } from 'dinero.js';
import { USD } from 'dinero.js/currencies';
const d1 = dinero({ amount: 500, currency: USD });
const d2 = dinero({ amount: 800, currency: USD });
const total = add(d1, d2);
toDecimal(total); // "13.00"
Check out the quick start guide on the documentation.
The documentation lets you learn about all aspects of the library.
Visit the full documentation to know more.
If you use AI coding agents (Claude Code, Cursor, GitHub Copilot, etc.), install the Dinero.js skills to teach your agent best practices, common pitfalls, and correct usage patterns.
npx skills add dinerojs/skills
Dinero.js is used by WooCommerce, Highlight, Cypress, Vercel, AWS Labs, Module Federation, and many more.
Overall
Maintained
Code review
npm
Latest release
Releases this year
(top 24 of 39)
32,342 followers · starred Jun 2018
1,730 followers · starred Nov 2018
2,581 followers · starred Jul 2021
123 followers · starred Oct 2018