Mortgage Calculator
Overview
Shared component MortgageCalculator.tsx mounted across /mortgage-calculator/*, loan-type hubs (FHA, VA, USDA, conventional, jumbo), embed routes, and programmatic variants. Computes PITI + loan-type fees + optional HOA from user inputs.
Core math: src/lib/mortgage-calculator-math.ts — computeMortgageScenario() orchestrates loan-type fees and P&I.
Formula
Monthly principal & interest (fixed-rate amortizing loan):
M = P × [r(1+r)^n] / [(1+r)^n − 1]
Where P = total loan amount (base + financed upfront fees when applicable).
Loan-type fee methodology
Conventional / jumbo / generic mortgage
- PMI: 0.5%/yr on base loan when down payment < 20%
- No upfront fee
- Source: industry-standard borrower-paid PMI convention
FHA — HUD Mortgagee Letter 2023-05
- Upfront MIP: 1.75% of base loan amount, financed into loan
- Annual MIP (30-year): 0.55%/yr when LTV > 95%; 0.50%/yr when LTV ≤ 95%
- Duration: life of loan when LTV > 90% at origination; otherwise 11 years
- Helper:
computeFHAMIP()
VA — 38 CFR 36.4313
- No monthly MI
- Upfront funding fee: financed into loan
- First use, regular military, 0% down: 2.15%
- 5% down: 1.75%; 10% down: 1.25%
- Exempt veterans (Purple Heart, disability): 0% via UI toggle
- Helper:
computeVAFundingFee() - MVP uses first-use regular-military rates; subsequent-use tiers available in helper
USDA — USDA RD Instruction 3555
- Upfront guarantee fee: 1% of base loan, financed
- Annual guarantee fee: 0.35%/yr on base loan balance (monthly = base × 0.0035 ÷ 12)
- Helper:
computeUSDAGuaranteeFee()
Inputs
| Input | Default | Notes |
|---|---|---|
| Home price | $300,000 | defaultHomePrice prop |
| Down payment | 20% | Dollar or percent mode |
| Loan term | 30 years | Hybrid slider 8–30 |
| Interest rate | 6.500% | Hybrid slider |
| Extra monthly payment | blank | Primary input row |
| VA funding fee exempt | false | Checkbox when loanType === 'va' |
| Annual property tax | $3,600 | |
| Annual home insurance | $1,200 | |
| Monthly HOA | $0 |
loanType prop drives fee math and MRC widget variant.
Outputs
- Monthly P&I (on total loan including financed fees)
- Tax, insurance, loan-type fee line (PMI / MIP / guarantee fee)
- Fee source footnote for FHA, VA, USDA
- Total interest, payoff with extra payment, amortization schedule
Assumptions
- Fixed-rate fully amortizing loans
- FHA/VA/USDA upfront fees financed into principal unless exempt (VA)
- Property tax and insurance are user-supplied annual totals
- Discount points and lender overlays not modeled
Files touched
src/lib/mortgage-calculator-math.tssrc/components/calculators/MortgageCalculator.tsxdocs/calculator-methodology/verification-2026-08.md
Related
- State variant pages: state-mortgage-calculator.md
- Verification matrix: verification-2026-08.md