Finance.js – financial JavaScript calculations

Financial JavaScript? Sure, try Finance.js.

A library for financial JavaScript calculations.

Finance.js makes it easy to incorporate common financial calculations into your application. The library is built on pure JavaScript without any dependencies. Awesome work is done by this implementation, so we don’t have to do such calculations manually. Instead, we call friendly functions.

A JavaScript library for financial calculations.
A JavaScript library for financial calculations.


npm install financejs --save


var Finance = require('financejs'); // or ES6 import
var fx = new Finance();

// To calculate Amortization
fx.AM(20000, 7.5, 5, 0);
// => 400.76

Amortization is the paying off of debt with a fixed repayment schedule in regular installments over a period of time.

More functions from the library

– Compound Annual Growth Rate (CAGR):

finance.CAGR(beginning value, ending value, number of periods);

– Compound Interest (CI)

finance.CI(rate, compoundings per period, principal, number of periods);

– Discount Factor (DF)

finance.DF(rate, number of periods);

– Future Value (FV)

finance.FV(rate, cash flow, number of periods);

– Internal Rate of Return (IRR)

finance.IRR(initial investment, [cash flows]);

– Leverage Ratio (LR)

finance.LR(total liabilities, total debts, total income);

– Net Present Value (NPV)

finance.NPV(rate, initial investment, [cash flows]);

– Payback Period (PP)

finance.PP(number of periods, [cash flows]);

– Present Value (PV)

finance.PV(rate, cash flow);

– Profitability Index (PI)

finance.PI(rate, initial investment, [cash flows]);

– Return on Investment (ROI)

finance.ROI(initial investment, earnings);

– Rule of 72 (R72)


– Weighted Average Cost of Capital (WACC)

finance.WACC(market value of equity, market value of debt, cost of equity, cost of debt, tax rate);

License: MIT

Homepage and Docs



See also

JavaScript algorithms implemented

JavaScript currency conversion library – money.js

SVG with JavaScript – svg.js and others

Numeral.js – formatting numbers in JavaScript

Good and simple jQuery charts plugin – Morris.js

Canvas based jQuery smoky backgrounds generator – waterpipe.js

Terminal dashboards with ASCII art and JavaScript