{
  "id": "loan",
  "version": "9e634a147ad7",
  "status": "published",
  "name": "Loan Calculator",
  "question": "What will my loan payment be?",
  "summary": "Computes the level payment, total interest, and yearly schedule of a fixed-rate loan for any payment frequency and compounding.",
  "category": "finance",
  "subcategory": "loans",
  "url": "https://www.acalculator.org/finance/loan-calculator",
  "markdown": "https://www.acalculator.org/finance/loan-calculator.md",
  "kind": "schedule",
  "method": "payment = L × i ÷ (1 − (1 + i)^−n), with L the loan, n = round(years × payments a year), and i = (1 + r/m)^(m/p) − 1 the rate per payment for a yearly rate r compounded m times a year and p payments a year.",
  "assumptions": [
    "The rate is fixed for the whole loan.",
    "Payments are equal and made at the end of each payment period.",
    "Interest for each payment period is the balance times the rate per payment.",
    "The number of payments is the term in years times the payments a year, rounded to a whole number.",
    "The last payment is whatever is left; values are not rounded to the cent between payments."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "amount": {
        "title": "Loan amount",
        "description": "The amount borrowed.",
        "type": "number",
        "x-unit": "USD",
        "exclusiveMinimum": 0,
        "maximum": 100000000
      },
      "rate": {
        "title": "Interest rate",
        "description": "The nominal yearly interest rate, compounded as chosen below.",
        "type": "number",
        "x-unit": "percent",
        "minimum": 0,
        "maximum": 50
      },
      "years": {
        "title": "Loan term (years)",
        "description": "The length of the loan in years; decimals are allowed (2.5 is two and a half years).",
        "type": "number",
        "exclusiveMinimum": 0,
        "maximum": 40
      },
      "freq": {
        "title": "Payments",
        "description": "How often you pay: 12, 24, 26, 52, 4, or 1 times a year.",
        "type": "string",
        "enum": [
          "12",
          "24",
          "26",
          "52",
          "4",
          "1"
        ]
      },
      "comp": {
        "title": "Interest compounds",
        "description": "How many times a year interest is compounded: 365, 12, 4, 2, or 1.",
        "type": "string",
        "enum": [
          "12",
          "365",
          "4",
          "2",
          "1"
        ]
      }
    }
  },
  "outputs": {
    "payment": {
      "label": "Your payment",
      "description": "The level payment made at each payment date (monthly, weekly, and so on, as chosen).",
      "format": "money"
    },
    "payments": {
      "label": "Number of payments",
      "description": "How many payments repay the loan.",
      "format": "integer"
    },
    "amount": {
      "label": "Loan amount",
      "description": "The amount borrowed.",
      "format": "money"
    },
    "interest": {
      "label": "Total interest",
      "description": "All the interest paid over the life of the loan.",
      "format": "money"
    },
    "paid": {
      "label": "Total of payments",
      "description": "The loan amount plus all the interest.",
      "format": "money"
    },
    "perPayment": {
      "label": "Rate per payment",
      "description": "The interest rate charged for each payment period, from the yearly rate and the compounding.",
      "format": "percent"
    },
    "effective": {
      "label": "Effective yearly rate",
      "description": "The yearly rate with compounding counted: (1 + rate per payment) to the power of payments a year, minus 1.",
      "format": "percent"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "amount": 25000,
      "rate": 7,
      "years": 5,
      "freq": "12",
      "comp": "12"
    },
    "outputs": {
      "payment": 495.0299635087383,
      "payments": 60,
      "amount": 25000,
      "interest": 4701.797810524298,
      "paid": 29701.7978105243,
      "perPayment": 0.5833333333333334,
      "effective": 7.229008085623567
    },
    "text": "A $25,000.00 loan at 7% over 5 years is repaid with 60 payments of $495.03, costing $4,701.80 in interest."
  },
  "examples": [
    {
      "given": {
        "amount": 20000,
        "rate": 7,
        "years": 5,
        "freq": "12",
        "comp": "12"
      },
      "expect": {
        "payment": 396.02397080699103,
        "interest": 3761.438248419458,
        "payments": 60,
        "effective": 7.229008085623589
      },
      "source": "hand calculation in content.mdx; Python 3 cross-check in docs/progress/WP-31/python/loan.py"
    },
    {
      "given": {
        "amount": 20000,
        "rate": 7,
        "years": 5,
        "freq": "26",
        "comp": "12"
      },
      "expect": {
        "payment": 182.49409098023565,
        "payments": 130,
        "interest": 3724.231827430642
      },
      "source": "hand calculation in content.mdx: rate per payment (1 + 0.07/12)^(12/26) − 1"
    },
    {
      "given": {
        "amount": 10000,
        "rate": 6,
        "years": 3,
        "freq": "4",
        "comp": "4"
      },
      "expect": {
        "payment": 916.7999290622892,
        "payments": 12,
        "perPayment": 1.5,
        "interest": 1001.5991487474663
      },
      "source": "hand calculation in content.mdx: 10,000 × 0.015 ÷ (1 − 1.015^−12)"
    },
    {
      "given": {
        "amount": 12000,
        "rate": 0,
        "years": 2.5,
        "freq": "52",
        "comp": "365"
      },
      "expect": {
        "payment": 92.3076923076923,
        "payments": 130,
        "interest": 0
      },
      "source": "hand calculation in content.mdx: 12,000 ÷ 130"
    }
  ],
  "sources": [
    "Consumer Financial Protection Bureau, What is the difference between a loan interest rate and the APR? https://www.consumerfinance.gov/ask-cfpb/what-is-the-difference-between-a-loan-interest-rate-and-the-apr-en-733/",
    "Consumer Financial Protection Bureau, What is amortization and how could it affect my auto loan? https://www.consumerfinance.gov/ask-cfpb/what-is-amortization-and-how-could-it-affect-my-auto-loan-en-771/",
    "Equivalent rates and the amortized loan payment: S. A. Broverman, Mathematics of Investment and Credit, chapter 1 (nominal and effective rates) and chapter 3 (amortization)."
  ],
  "related": [
    "amortization",
    "personal-loan",
    "business-loan",
    "loan-payoff"
  ],
  "changelog": []
}
