Closing Cost Calculator Formula

Understand the math behind the closing cost calculator. Each variable explained with a worked example.

Formulas Used

Total Closing Costs

total_closing_costs = lender_fees + title_and_gov + prepaids

Closing Costs as % of Price

closing_cost_pct = (lender_fees + title_and_gov + prepaids) / home_price * 100

Total Lender Fees

lender_fees_total = lender_fees

Title & Government Fees

title_gov_total = title_and_gov

Total Prepaids / Escrow

prepaids_total = prepaids

Variables

VariableDescriptionDefault
home_priceHome Purchase Price(USD)350000
loan_amountLoan Amount(USD)280000
origination_fee_pctLoan Origination Fee(%)1
appraisal_feeAppraisal Fee(USD)500
title_insuranceTitle Insurance(USD)1500
attorney_feeAttorney / Settlement Fee(USD)800
recording_feeRecording Fee(USD)200
prepaid_taxes_monthsPrepaid Property Tax (months)3
monthly_taxMonthly Property Tax(USD)350
prepaid_insurance_monthsPrepaid Insurance (months)14
monthly_insuranceMonthly Homeowner Insurance(USD)125
origination_feeDerived value= loan_amount * origination_fee_pct / 100calculated
prepaid_taxesDerived value= prepaid_taxes_months * monthly_taxcalculated
prepaid_insuranceDerived value= prepaid_insurance_months * monthly_insurancecalculated
lender_feesDerived value= origination_fee + appraisal_feecalculated
title_and_govDerived value= title_insurance + attorney_fee + recording_feecalculated
prepaidsDerived value= prepaid_taxes + prepaid_insurancecalculated

How It Works

Understanding Closing Costs

Closing costs are fees and expenses paid at settlement when a real estate transaction is finalized. They typically range from 2% to 5% of the home purchase price.

Major Categories

  • Lender fees: Origination charges, appraisal, credit report, underwriting
  • Title and government fees: Title search, title insurance, recording fees, transfer taxes
  • Prepaids and escrow: Upfront property tax, homeowner insurance, and prepaid interest
  • Who Pays What

    Buyers typically pay lender fees, prepaids, and a portion of title costs. Sellers often cover agent commissions and transfer taxes, though everything is negotiable.

    Worked Example

    A $350,000 home with a $280,000 loan. Origination fee 1%, appraisal $500, title insurance $1,500, attorney $800, recording $200, 3 months tax at $350/mo, 14 months insurance at $125/mo.

    home_price = 350000loan_amount = 280000origination_fee_pct = 1appraisal_fee = 500title_insurance = 1500attorney_fee = 800recording_fee = 200prepaid_taxes_months = 3monthly_tax = 350prepaid_insurance_months = 14monthly_insurance = 125
    1. 01Origination fee: $280,000 x 1% = $2,800
    2. 02Lender fees: $2,800 + $500 = $3,300
    3. 03Title & government: $1,500 + $800 + $200 = $2,500
    4. 04Prepaid taxes: 3 x $350 = $1,050
    5. 05Prepaid insurance: 14 x $125 = $1,750
    6. 06Total prepaids: $1,050 + $1,750 = $2,800
    7. 07Total closing costs: $3,300 + $2,500 + $2,800 = $8,600
    8. 08As percentage of price: $8,600 / $350,000 = 2.46%

    Ready to run the numbers?

    Open Closing Cost Calculator