When I built a free dividend payout calculator, the interesting part wasn't the UI — it was the math. Dividend yield, payout ratio, and especially the way a DRIP (dividend reinvestment plan) compounds year over year. So I pulled the formulas out into a tiny, zero-dependency TypeScript library: dividend-math.
This post is the story of the library and the one calculation that surprised me: how reinvestment plus growth quietly outruns a flat high yield.
The library
dividend-math is one file of pure functions. No runtime dependencies, no I/O, fully tree-shakeable. You can npm install dividend-math or just copy src/dividend.ts into your project.
import {






