How DebtWren calculates, rounds and checks
Every formula, convention and rounding rule behind the calculators, plus the tests they must pass. The same rules generate the “Show working” steps under each result.
Principles
- Show the working. Each calculator returns an ordered list of steps with the formula, the inputs and the result. The “Show working” panel is built from that list, so it can’t drift from the figure it explains.
- State assumptions. Every result lists the assumptions it relied on: that interest is charged monthly at APR ÷ 12, that your budget stays the same every month, and that no new borrowing happens.
- Never guess silently. Inputs outside documented limits are clamped with a visible message, never quietly truncated. Ambiguous numbers such as
85.000,50typed on an English-language page are rejected with a message rather than read one way or the other. - Calculate, don’t advise. Comparisons are phrased “in this scenario”. Nothing on the site recommends a product, a lender or a decision.
Arithmetic and rounding
Money is computed with exact decimal arithmetic (the decimal.js library at 50 significant digits), not the binary floating point that makes 0.1 + 0.2 come out as 0.30000000000000004. Amounts up to one trillion in major units keep every digit.
Rounding is explicit and documented per calculator. The default is half-up (ties away from zero) to the currency’s minor unit under ISO 4217: two decimals for pounds, none for the Japanese yen, three for the Kuwaiti dinar. Interest on a balance is rounded at each step to the minor unit before it is added to the balance, so every row of a schedule reconciles exactly.
Amounts are formatted with your browser’s locale (for example 1,234.50 or 1.234,50). Typing accepts thousands separators, currency symbols, a minus sign or brackets for negatives, and shorthand such as 85k or 1.2m.
Avalanche vs snowball
The payoff calculator runs two well-known strategies, plus a custom order of your own. The same simulation also powers the stay-put path of the balance transfer calculator.
- Avalanche targets the debt with the highest APR first, because that is the balance charging the most interest per pound. Ties break by smaller balance, then larger minimum payment, then label, then id.
- Snowball targets the debt with the smallest balance first, so you clear accounts quickly and free their minimum payments sooner. Ties break by higher APR, then larger minimum payment, then label, then id.
- Custom pays debts in the order you set; any debt you don’t place follows the avalanche order.
The dedicated debt snowball calculator runs this same engine locked to smallest-balance-first order and shows the avalanche figures alongside for comparison. The debt avalanche calculator locks it to highest-APR-first order and shows the snowball figures alongside. Both accept the budget either as a total a month or as an extra on top of today’s minimums, and both can start from a chosen month so each payoff has a date.
The order is fixed at the start, so the result is the same however you happen to have entered the rows. Example: a £3,000.00 credit card at 24% APR and an £8,000.00 personal loan at 9% APR, with a £500.00 monthly budget, are cleared by the avalanche method in 25 months with £1,311.13 of total interest. The snowball method takes 25 months and costs £1,311.13, so here the avalanche method saves £0.00 in interest.
Month-by-month simulation
The calculator walks forward one month at a time, exactly as a lender would, and stops when every balance reaches zero:
- Charge interest. Each debt accrues
interest = round(balance × APR ÷ 12), added to the balance. - Pay the minimums. Every debt pays its minimum (capped at the balance, so a final payment can’t overpay).
- Apply the rest. Whatever is left of your budget goes to the target debt in method order, cascading to the next target as each one clears. Freed minimums roll over automatically because the budget is constant.
Two guardrails keep the result honest. If your budget is below the sum of the minimum payments, the calculator stops and names the shortfall rather than pretending the debt shrinks. If a debt’s minimum is less than its first month’s interest, it is flagged “never repaid at the minimum”, because at that minimum the balance would only grow. The simulation is capped at 100 years and always terminates.
Loan consolidation
The consolidation calculator prices a single replacement loan against your current debts. The new loan uses the standard annuity formula PMT = P × i ÷ (1 − (1 + i)^−n), where P is the amount consolidated, i the monthly rate and n the number of months. Each period’s interest is round(balance × i) and the final payment absorbs the rounding residual.
Because “one loan at a lower APR” can still cost more overall if the term stretches out, the calculator shows the monthly payment, the total interest, and the date you’d be debt-free for both the consolidation loan and your current arrangement, side by side. Real lenders’ figures can differ because of fees, day-count conventions and their own rounding; the calculator notes this and never adds fees you haven’t entered.
Credit card minimum payment
The minimum-payment calculator applies the issuer’s rule you choose, then simulates how long the card takes to clear and what it costs. The common rules are built from two pieces: a fixed floor (for example £5 or £25) and a percentage of the balance (for example 1% or 2.5%), with the minimum being the greater of the two — capped at the full balance so you never overpay. Interest (and, where you add them, fees) accrue on top the same way as in the payoff calculator.
Because a card minimum that only just covers the interest can leave the balance almost unchanged, the calculator always reports the “interest-only” point and how the minimum itself changes as the balance falls, so a payment that clears the card today is compared with paying only the minimum each month.
Credit card payoff
The credit card payoff calculator accepts the rate in three conventions: a nominal APR (i = APR ÷ 12, the US, Canadian and Australian meaning), an APR that is an effective annual rate (i = (1 + APR)^(1/12) − 1, the UK and Irish meaning under CONC App 1.2), or the monthly rate printed on a statement (i = rate). APRs are limited to 0–100% and monthly rates to 0–10%. It runs its own monthly loop rather than the loan amortiser so that an annual fee can be added to the balance. In month m: if m is a multiple of 12 and the card is still open, the annual fee is added to the balance; interest round(balance × i) is added, half-up to the minor unit; then the payment min(P + extra + any lump sum that month, balance) is taken off. The principal repaid that month is payment − interest − fee, which can be negative.
In fixed-payment mode P is the amount you enter. In clear-by mode (1–600 months) P is the smallest level payment, to the minor unit, whose simulation leaves a zero balance within the target: the solver seeds it with the rounded-up annuity payment on the balance plus fees minus lump sums and extras, raises it until any residual clears, then steps down one minor unit at a time while the balance still clears. “Never repaid” means the regular payment (P + extra) is no more than the first month’s interest, the Regulation Z §1026.7(b)(12) test; a lump sum can still clear the card, in which case the months are finite. The minimum-only comparison reuses the minimum-payment engine at the nominal-equivalent APR 12 × i so both paths charge the same periodic rate, and it models no fees. The +25 / +50 / +100 a month comparisons are shown only for currencies with two minor units. The persistent-debt flag is the rolling FCA CONC 6.7.27R test: at every month from 18 onward, over the previous 18 months, if interest and fees exceed the principal repaid and the closing balance never fell below 200 in the chosen currency, the flag is raised at the first such month. The simulation is capped at 1,200 months.
Credit card interest
The card interest calculator is arithmetic on one balance, not a payment schedule. From the monthly rate i (derived with the same three rate conventions as above) it works out the nominal APR 12 × i, the effective annual rate (1 + i)^12 − 1, and the daily periodic rate nominal APR ÷ day count, where the day count is 365 or 360 as you choose. Interest per day is round(balance × daily rate), per month round(balance × i), per year with the balance held flat round(balance × nominal APR), and per year compounded round(balance × effective annual rate), each rounded half-up to the minor unit independently, so the daily figure times 30 need not equal the monthly figure.
The billing-cycle figure follows the average-daily-balance method in Regulation Z §1026.14(d): interest = round(ADB × daily rate × cycle days), where the average daily balance is the sum over each day of the cycle of the running balance (start balance plus every transaction dated on or before that day, with days in credit counted as zero) divided by the days in the cycle (1–366, up to 200 transactions). The “carried” table lets the interest compound unpaid for 1–60 months, adding round(balance × i) each month with no payments, spending or fees.
Balance transfer
The balance transfer calculator compares moving up to ten card balances to a promotional card with staying put. The fee is round(clamp(ΣB × fee%, fee minimum, fee maximum)) (0–10%), is added to the new balance and sits at the promotional rate, so the transferred balance is B′ = ΣB + fee. Monthly rates come from the nominal (APR ÷ 12) or effective ((1 + APR)^(1/12) − 1) convention for both the promotional and the go-to APR. The transfer path is a direct monthly loop: in months 12, 24, … any annual fee is added first; interest round(balance × i) is added at the promotional rate while m ≤ promo months (0–48) and at the go-to rate afterwards; then min(P, balance) is paid. The balance after the last promotional month is reported as the residual.
With a fixed payment, P is as entered. In “clear within the promo” mode P starts as the rounded-up annuity payment on B′ over the promo months at the promo rate (roundUp(B′ ÷ n) at 0%), and while a residual remains at the end of the promo (rounding, or annual fees inside the window) it is raised by max(1 minor unit, roundUp(residual ÷ annuity factor)) and re-simulated, converging on the smallest payment that clears the balance in time. The stay-put path runs the payoff simulation in avalanche order at the same P; because that simulation charges APR ÷ 12, effective APRs are first converted to their nominal equivalents 12 × ((1 + APR)^(1/12) − 1), and if P is below the cards’ minimums (2.5% of each balance when you don’t enter one) the stay path pays those minimums instead and says so. Saving = stay total paid − transfer total paid, and months saved likewise; both are blank if either path does not clear. Break-even months = fee ÷ (Σ round(B_k × i_k) − round(B′ × i_promo)) to one decimal, a first-order figure that assumes the balances stay constant and is blank when the promo avoids no interest. “Never clears” means the payment is no more than the go-to-rate interest on the residual. Both paths are capped at 1,200 months.
Loan payoff
The loan payoff calculator starts from the balance you owe today. The periodic rate is i = APR ÷ p for a nominal rate or (1 + APR)^(1/p) − 1 for an effective one, with p = 12 for monthly payments (26 for fortnightly). If you give your payment P, the remaining number of payments is n = ⌈−ln(1 − i·B ÷ P) ÷ ln(1 + i)⌉ (⌈B ÷ P⌉ at 0%); P must exceed the first period’s interest round(B × i) or the calculator stops with a “payment below interest” error, and if P differs from the level payment for n periods a note shows the difference. If you give the remaining term instead (1–480 months), P is the level annuity payment B × i ÷ (1 − (1 + i)^−n) rounded half-up to the minor unit. When both are entered, the payment wins.
The baseline schedule is the shared amortiser: interest each period is round(balance × i), the payment is min(P, balance + interest), and with a term given the final contractual payment absorbs the rounding residual so the balance ends at exactly zero; with a payment given the schedule simply runs until the balance is zero. The accelerated schedule adds a regular extra per period, up to 50 one-off lump sums and a recurring lump, applied after the scheduled payment and never exceeding the remaining balance. “Reduce term” keeps the payment fixed; “reduce payment” recalculates the level payment on the remaining balance over the remaining contractual periods after each extra, and is only available when the term was given (with a fixed payment the calculator falls back to reducing the term and says so). Interest saved and payments saved are the baseline minus the accelerated figures; months are periods × 12 ÷ p to one decimal. An early repayment charge is applied only when extras were paid: a fixed amount; round(Σ extras × pct ÷ 100); or the UK deferred-settlement convention under the Consumer Credit (Early Settlement) Regulations 2004, round(balance × ((1 + i_m)^(days ÷ 30.4167) − 1)) on the opening balance of the final accelerated period, with 28 days, or 58 days (28 plus a calendar month) for agreements over 12 months, and i_m the monthly rate. Net saving = interest saved − charge. Nothing is simulated beyond 100 years.
Car loan payoff, bi-weekly payments and settlement
The car loan payoff calculator uses the loan payoff engine in reduce-term mode, with a prepayment penalty treated as a fixed charge or a percentage of the amount prepaid. Its bi-weekly comparison pays half the monthly payment every two weeks: the fortnightly payment is round(P ÷ 2), the fortnightly rate is APR ÷ 26 (nominal) or (1 + APR)^(1/26) − 1 (effective), and both plans are simulated with a fixed payment until the balance is zero, each period charging round(balance × i). Each payment must exceed its first period’s interest. Months elapsed on the fortnightly plan are payments × 12 ÷ 26 to one decimal, and months saved is the monthly plan’s payment count minus that figure.
The UK and Ireland settlement estimate is balance + round(balance × ((1 + i_m)^(days ÷ 30.4167) − 1)) with 28 or 58 deferment days and a month taken as 30.4167 days. It is explicitly an estimate: under the 2004 Regulations the lender rebates interest on the original schedule by the actuarial method, so the lender’s figure can differ.
Debt-to-income ratio
The debt-to-income calculator is a ratio with no interest and no simulation. Up to six gross income sources are converted to a month (annual ÷ 12, monthly × 1, weekly × 52 ÷ 12, fortnightly × 26 ÷ 12), summed and rounded half-up to the minor unit; a total of zero is reported as an error, never divided by. The front-end ratio is housing ÷ monthly income × 100 and the back-end ratio (housing + Σ debt payments) ÷ monthly income × 100, each rounded half-up to one decimal, with up to 20 debt payments. The tier is a rule of thumb from US mortgage underwriting applied to the back-end figure: 36 or less comfortable, 43 or less manageable, 50 or less stretched, above 50 high. It is not a lender rule; UK, Irish, Australian and New Zealand lenders use affordability and loan-to-income tests instead.
Against a target ratio (1–100%, default 36), the room for a new monthly payment is max(0, target × monthly income − commitments) rounded down, and the income at which today’s commitments would sit exactly at the target is commitments ÷ target rounded up; both directions are chosen so the target still holds after rounding. Each debt’s share of income is rounded half-up to one decimal.
Credit utilization
The credit utilization calculator divides balances by limits for up to 20 cards. Per card, balance ÷ limit × 100 rounded half-up to one decimal; a card with no limit (zero or blank) is listed but left out of every total, with a warning. Overall utilization is Σ balance ÷ Σ limit × 100 over the included cards, and the band is read from that displayed figure: under 10 excellent, under 30 good, under 50 fair, under 75 high, 75 and above very high. For a target T (1–100%, default 30), the payment that reaches it is max(0, balance − T × limit) per card and max(0, Σ balance − T × Σ limit) overall, and the limit increase that would reach it without paying is max(0, Σ balance ÷ T − Σ limit); all three are rounded up to the minor unit so the target is actually met.
When you enter a planned payment it is allocated by water-filling, which minimises the highest per-card utilization: the card or cards at the top utilization are paid down to the next level below, which costs Σ limit × (u_top − u_next); if the remaining payment covers that, the levels merge and the step repeats, otherwise what is left is spread over the top cards pro-rata by limit so they all fall by the same amount. Exact amounts are rounded half-up to the minor unit and the rounding remainder goes to the highest-utilization card, then the next. A payment larger than the balances clears every card and the surplus is reported as unallocated. The allocation ignores interest rates: it is a utilization strategy, not an interest-saving one.
UK student loan repayment
The UK student loan calculator projects Plans 1, 2, 4, 5 and Postgraduate (optionally two at once) one tax year at a time from 2026/27. Salary grows by (1 + g)^y each year, half-up to the penny. Each plan’s threshold is the published figure for tax years in the data table, stays unchanged while that plan’s threshold is frozen, and otherwise rises by the RPI assumption each April, half-up to the pound. The monthly PAYE deduction is roundDown(rate × max(0, salary ÷ 12 − threshold ÷ 12)) to whole pounds, as in the GOV.UK examples; weekly uses ÷ 52. A Postgraduate loan stacks with an undergraduate one (6% over the Postgraduate threshold plus 9% over the undergraduate threshold); two undergraduate plans share one 9% deduction over the lower threshold, with the slice between the thresholds going to the lower-threshold plan and the slice above the higher one split equally, an approximation of the SLC apportionment.
Interest for an academic year the table covers uses the published rate; otherwise Plans 1, 4 and 5 use RPI, Postgraduate uses min(RPI + 3%, cap), and Plan 2 uses min(cap, RPI + 3% × clamp((salary − lower) ÷ (upper − lower), 0, 1)), rounded half-up to two decimals, with the Plan 2 band edges uprated with its threshold once they are no longer published. Each month adds round(balance × rate ÷ 12) to the penny, then takes min(balance, PAYE + overpayment); a lump sum comes off before month 1. Any balance left at the start of the April that is the plan’s write-off term after the first April you were due to repay (Plan 1: 25 years; Plans 2, 4 and Postgraduate: 30; Plan 5: 40) is cancelled. The loop ends when every loan is cleared or written off and is capped at 100 years. The “with overpayments” path repeats the projection and compares the total repaid, so it can report that overpaying costs more when the loan would have been written off anyway. The Bank of England base-rate + 1% cap on Plans 1 and 4, bonuses, Self Assessment and multiple jobs are not modelled.
How we test
- Known answers. Each calculator must reproduce the worked examples in our specification to the cent — for example a single £1,000.00 balance at 12% APR cleared with a £200.00 monthly budget in a stated number of months and a stated amount of interest.
- Property tests. Randomized tests check invariants — that the sum of every payment equals the starting balances plus interest, that minimums are paid before any extra, and that avalanche never costs more in interest than snowball for the same debts and budget.
- Browser tests. Every calculator page is tested in a real browser and its on-screen figures compared with the engine called directly, and we check that no figure you type appears in any network request.
Reporting errors
If a figure, rate or explanation looks wrong, email errors@debtwren.com with the calculator, the inputs and what you expected. Corrections are dated in the changelog.