Snowball or avalanche? Most debt payoff advice stops at "pay the smallest balance first" or "pay the highest rate first". The useful part is seeing the actual numbers side by side for your own debts. I built a small calculator to do that, and it turned out to be a good example of how much you can do with one HTML file and no backend.
The two methods in one paragraph
- Snowball: pay minimums on everything, put every extra dollar on the smallest balance. When it is gone, roll its payment into the next smallest.
- Avalanche: same idea, but target the highest interest rate first.
Avalanche usually costs less interest. Snowball usually gives you quick wins sooner. Which one fits depends on the debts, so it is worth simulating both.
The core loop
Each month: add interest to every balance, pay the minimums, then send whatever is left to the target debt.
function simulate(debts, extra, order) {
let d = debts.map(x => ({...x}));
let month = 0, interest = 0;
while (d.some(x => x.bal > 0) && month < 600) {
month++;
d.forEach(x => {
const i = x.bal * x.apr / 12 / 100;
x.bal += i; interest += i;
});
let pool = extra;
d.forEach(x => {
const p = Math.min(x.bal, x.min);
x.bal -= p;
pool += x.min - p;
});
const target = d.filter(x => x.bal > 0).sort(order)[0];
if (target) target.bal -= Math.min(target.bal, pool);
}
return { month, interest };
}
const snowball = (a, b) => a.bal - b.bal;
const avalanche = (a, b) => b.apr - a.apr;
Run both with the same debts and the same extra payment, then compare months and total interest. That is the whole trick. The 600-month cap stops it looping forever when minimums do not cover interest.
Why a single HTML file
- Your numbers stay in your browser. Nothing is uploaded.
- It works offline once saved.
- There is nothing to host or log in to.
If you want it ready-made
I packaged this as Debtfree Pro: snowball vs avalanche comparison, interest saved and a debt-free date, in one HTML file. It is a planning aid, not financial advice.
- Gumroad: https://cupj.gumroad.com/l/debtfree-pro
- More small tools (contracts, budget tracker, resume builder, invoices): https://prokit-hub.surge.sh/
- Payhip store: https://payhip.com/DigiMoraLap
The code above is yours to reuse either way.
Top comments (0)