Almost every finance calculator I opened last year wanted something first: an account, an app install, or a page that re-renders and throws away the numbers I just typed. My actual questions were small. What is my real take-home pay after the Korean social insurances? How much interest does an extra $200 a month really save on a mortgage?
So I built the boring version: a static site, one HTML file per calculator, no accounts, no backend, everything computed in the browser. The Korean side covers household money questions (severance pay, take-home pay, deposit interest, subsidy and pension lookups). The English side is loans: mortgage payoff, PMI removal, refinance break-even, auto loans, debt payoff, plus a vCard-to-CSV converter that never uploads the file.
This post is the engineering half of that project: the formulas, the rounding traps that bit me, and how 40+ pages stay consistent without a framework.
Live examples: the English loan calculators, mortgage payoff with extra payments, debt snowball vs avalanche.
Why static HTML in 2026
The feature set is "take ten numbers, do arithmetic, print six numbers". There is no state to sync, nothing to authorize, and no reason for a round trip. A server would only add a database full of other people's debts that I do not want to hold, a session layer, and a bill.
The trade-off is real. Without a framework I had to solve by hand the things frameworks give you: routing, per-page metadata, shared layout, and the constant risk that page 27 still runs last season's formula. Most of the pipeline section below is about exactly that.
The math
1. Mortgage payoff with extra payments
The payment itself is the standard annuity formula:
const r = apr / 100 / 12; const n = years * 12; const pay = r ? P * r / (1 - Math.pow(1 + r, -n)) : P / n; The interesting part is what happens after. To answer "what does an extra $200 a month save", you amortize twice - once with the extras, once without - and diff the totals. One loop handles monthly extras, an annual lump sum and a one-off payment in month k:
function amort(P, r, n, pay, extraMonthly, extraYearly, extraOnce, onceMonth) { let b = P, i = 0, interest = 0; const rows = []; let year = { principal: 0, interest: 0, extra: 0 }; while (b > 0.005 && i < n + 1200) { i++; const int = b * r; const principal = Math.min(pay - int, b); if (principal < 0) return null; b -= principal; let extra = 0; if (b > 0) { extra = extraMonthly + (i % 12 === 0 ? extraYearly : 0) + (i === onceMonth ? extraOnce : 0); extra = Math.min(extra, b); b -= extra; } interest += int; year.principal += principal; year.interest += int; year.extra += extra; if (i % 12 === 0 || b <= 0.005) { rows.push({ year: Math.ceil(i / 12), ...year, balance: Math.max(b, 0) }); year = { principal: 0, interest: 0, extra: 0 }; } } return { months: i, interest, rows }; } Three guards matter more than the math itself:
-
b > 0.005- stop on cents, not on floating-point dust. Without it a loan "ends" a month late with a $0.0000000004 balance. -
i < n + 1200- a payment below the monthly interest never terminates the loop. This is the bug that hangs tabs. -
principal < 0- turn that bad input into "no result" instead of a negative balance that silently grows.
2. PMI removal
Private mortgage insurance is supposed to come off on its own at 78% loan-to-value on the original amortization schedule, and most servicers will remove it earlier on request at 80%. So the calculator runs the same schedule, computes balance / originalPrice every month, and reports the first month each threshold is crossed - plus the gap in months between "automatic" and "if I ask", because that gap is real money:
if (!requestDate && balance / originalPrice <= 0.80) requestDate = monthAt(i); if (!autoDate && balance / originalPrice <= 0.78) autoDate = monthAt(i); 3. Refinance break-even
The whole refinance decision reduces to one division:
const monthlySaving = oldPayment - newPayment; const breakEvenMonths = closingCosts / monthlySaving; If monthlySaving <= 0 the answer is "never", and the UI says so instead of printing Infinity. The number people want next is interest paid after the break-even point, so the page amortizes both loans to term and shows the year the new loan gets ahead.
4. Debt snowball vs avalanche
Both strategies are the same simulation with a different sort key: snowball orders debts by balance, avalanche by APR. Minimums first, then every spare dollar onto the first debt in the list:
function payoff(debts, extra, sortKey) { const list = debts.map(d => ({ ...d })).sort(sortKey); let month = 0, interestPaid = 0; while (list.some(d => d.balance > 0.005) && month < 1200) { month++; let pool = extra; for (const d of list) { if (d.balance <= 0.005) continue; const int = d.balance * d.apr / 1200; interestPaid += int; d.balance += int; const min = Math.min(d.min, d.balance); d.balance -= min; pool -= min; } for (const d of list) { if (pool <= 0.005) break; const paid = Math.min(pool, d.balance); d.balance -= paid; pool -= paid; } } return { month, interestPaid }; } Interest accrues before the payment, the way servicers do it, and the leftover pool is applied in sorted order. That one detail is the whole difference between snowball and avalanche: same code, different comparator.
5. Korean severance pay
Korean severance pay (퇴직금) is not "salary times years". The statutory shape is:
severance = averageDailyWage × 30 × (daysEmployed / 365) where the average daily wage is total wages of the last three months divided by the calendar days in that period - bonuses and allowances included, not just base salary. Using the contract salary instead of the three-month average is the most common mistake in Korean severance calculators, so the input asks for three months of gross pay.
Take-home pay runs the other direction: income tax by bracket, local income tax as a fraction of it, then the employee share of the four social insurances. All of those rates live in one dated config object, because they change every January and a calculator hard-coding 2024 rates in 2026 is worse than no calculator at all.
6. Parsing vCards without uploading them
The vCard-to-CSV converter runs entirely in the tab. vCard looks simple until it isn't:
- 2.1, 3.0 and 4.0 have different escaping rules.
- Long lines are folded with a CRLF plus one space or tab. Unfold before parsing, or every property after column 75 is garbage.
- 2.1 sometimes uses quoted-printable, so
=3Bis a semicolon hiding in the middle of a name. - Escaped commas and semicolons inside a field are data, not separators.
Splitting on ; gets 90% of contacts right and silently corrupts the rest. Unfold first, split on unescaped separators, then decode. Because the file never leaves the browser, the privacy story is one sentence instead of a policy page.
The rounding traps
Three bugs took longer than any formula:
- Half-cent residue. Amortization leaves fractions of a cent everywhere. Compare against
0.005, never against0. - Rounding in the middle. Round only when rendering (
Intl.NumberFormat), never between steps. Rounding each month's interest to cents makes the schedule disagree with the total by dollars. - The last payment. Clamp it with
Math.min(payment, balance). Otherwise the final row pays interest on money that no longer exists.
Dates are their own trap. Months are 0-indexed in JS, so "12 months from November 2026" is new Date(2026, 10 + 12, 1), and the rollover lands on November 2027 by itself. Doing the same thing with setMonth() on a day-31 date silently slides backwards into the wrong month.
The pipeline: one HTML file per tool, nothing else
Each calculator is one HTML page with its own <title>, meta description, canonical URL and JSON-LD (WebApplication, FAQPage, BreadcrumbList). A shared CSS file and a few small helpers do the rest. No bundler, no framework, no build step to break: deploying means putting files behind a CDN (Cloudflare serves this one).
The cost is discipline. With 40 pages the failure mode is not a crash, it is drift - three pages still running last season's tax brackets, one page linking to a calculator that was renamed. Two habits keep it honest: every page keeps its formula in one commented block with the source of the rates above it, and the internal links get a sweep whenever a URL changes.
Where a chart earns its weight (the payoff curve) the page loads Chart.js from a CDN. That is the only third-party script that survived; analytics and ads are the part of the page I doubt most.
What I'd do differently
Move the formulas out of the pages into one ES module per domain (loans, payroll, tax) and have the pages import it. Right now the amortization loop exists once per loan page, and "once per page" is exactly how three slightly different versions of the same loop appear. A 30-line test page running a handful of fixed scenarios would have caught every rounding bug in minutes instead of in a bug report.
The rest I'd keep. Static HTML, no account, no upload - the constraint that made the project small is also what makes it checkable. You can hit view-source and verify the math yourself, which is not something you can say about most calculators.
Numbers to poke at: tools.newbizok.com/en for the loan and debt tools, tools.newbizok.com for the Korean household ones.