Annuities and Perpetuities Explained: Formulas, Use Cases, Code & Common Mistakes
If you’ve ever taken out a mortgage, planned for retirement, valued a dividend stock, or even paid rent, you’ve interacted with the financial concepts of annuities and perpetuities—even if you didn’t realize it. As of 2026, 62% of DIY investors and FIRE (Financial Independence, Retire Early) movement followers report using these time value of money calculations to make major financial decisions, per a recent NerdWallet survey. Getting these calculations right can mean the difference between hitting your retirement goal 5 years early or running out of savings 10 years into retirement. In this guide, we’ll break down everything you need to know about annuities and perpetuities, from core formulas to real-world use cases, production-ready Python code, and common mistakes to avoid.
By Tom Roberts · Editor, Quantopia
Published · Updated
Table of Contents#
- Core Foundational Concepts
- Types of Annuities and Perpetuities (With Formulas & Examples)
- Real-World Applications of Annuities and Perpetuities
- Python Implementation for Custom Calculations
- Common Pitfalls & Best Practices
- Conclusion
- References
Core Foundational Concepts#
All annuity and perpetuity calculations are built on three core financial principles:
Time Value of Money (TVM)#
The fundamental rule that a dollar today is worth more than a dollar in the future, because you can invest that dollar to earn interest or returns over time. For example, 105 in one year, so 100 today.
Key Definitions#
- Annuity: A series of equal, periodic cash flows (payments or receipts) that occur at regular intervals over a finite period of time. Common examples include monthly mortgage payments, 20-year retirement payout plans, and quarterly bond coupon payments.
- Perpetuity: A special type of annuity where cash flows continue indefinitely (forever).
- Discount Rate (): The interest rate used to calculate the present value of future cash flows, accounting for investment risk and opportunity cost.
- Compounding Frequency (): The number of times interest is calculated per year (e.g., 12 for monthly, 4 for quarterly). To avoid calculation errors, your discount rate and number of periods must match your cash flow frequency:
- Periodic rate:
- Total periods:
Types of Annuities and Perpetuities (With Formulas & Examples)#
Below we break down the 5 most common types of annuities and perpetuities, with clear formulas and practical examples for each.
Ordinary Annuity#
Payments occur at the end of each period, which is the standard default assumption for most consumer and corporate finance use cases (e.g., mortgages, student loans, standard bonds).
Formulas#
- Present Value (PV, the lump sum value of all future cash flows today):
- Future Value (FV, the total value of all cash flows at the end of the annuity term):
Example#
You take out a 3-year car loan with 450 monthly payments and a 6% annual interest rate (0.5% monthly rate). The maximum loan amount you can borrow (PV) is: $$PV = 450 \times \frac{1 - (1 + 0.005)^{-36}}{0.005} \approx \14,791.96$$
Annuity Due#
Payments occur at the beginning of each period. Common examples include rent payments, lease agreements, and annual insurance premiums. Because all cash flows are received one period earlier, they accrue an extra period of interest, so PV and FV are both higher than ordinary annuities by a factor of .
Formulas#
Example#
You sign a 12-month lease for 23,566.28, compared to ~$23,487.99 for an ordinary annuity—an extra $78.29 in value for the landlord from earlier payments.
Ordinary Perpetuity#
Constant payments occurring at the end of each period forever. There is no future value for a perpetuity, as the sum of infinite cash flows grows to infinity.
Formula#
Example#
A preferred stock pays a fixed 3 annual dividend indefinitely, and you require a 6% annual return to invest. The maximum price you should pay for the stock is: $$PV = 3 / 0.06 = \50$$
Growing Annuity#
A finite series of cash flows that grow at a constant rate () each period. Common use cases include inflation-adjusted retirement withdrawals and multi-year salary contracts with fixed annual raises.
Formulas#
When : When (rare edge case): Note: is the cash flow at the end of the first period. If you have a current cash flow , calculate .
Growing Perpetuity#
A series of cash flows growing at a constant rate () forever. For the formula to produce a valid finite value, the discount rate must be higher than the growth rate —if , the sum of cash flows diverges to infinity and is not financially meaningful.
Formula#
Example#
A publicly traded company paid a 2 dividend yesterday, and you expect dividends to grow at 5% per year forever, with a 7% required return. The fair value of the stock is: $$PMT_1 = 2 \times 1.05 = 2.10$$ $$PV = 2.10 / (0.07 - 0.05) = \105$$
Real-World Applications of Annuities and Perpetuities#
These calculations are used across personal finance, corporate finance, and investing every day:
- Retirement Planning: Calculate how much you need to save monthly (FV of ordinary annuity) to hit your target nest egg, and how much you can safely withdraw monthly (PV of growing annuity, adjusted for inflation) during retirement.
- Amortizing Loan Calculations: Determine monthly payments for mortgages, car loans, and student loans using the rearranged ordinary annuity PV formula:
- Equity Valuation: The widely used Gordon Growth Model for dividend-paying stocks is exactly the growing perpetuity formula.
- Preferred Stock Valuation: Fixed-dividend preferred stocks are valued as ordinary perpetuities.
- Endowment & Scholarship Funds: To fund a 15,000 / 0.04 = $375,000.
Python Implementation for Custom Calculations#
Below are production-ready, dependency-free Python functions to calculate all common annuity and perpetuity metrics, no NumPy or Pandas required:
def pv_ordinary_annuity(pmt, r, n):
"""Calculate the Present Value of an Ordinary Annuity."""
if r == 0:
return pmt * n
return pmt * (1 - (1 + r)**(-n)) / r
def fv_ordinary_annuity(pmt, r, n):
"""Calculate the Future Value of an Ordinary Annuity."""
if r == 0:
return pmt * n
return pmt * ((1 + r)**n - 1) / r
def pv_annuity_due(pmt, r, n):
"""Calculate the Present Value of an Annuity Due."""
return pv_ordinary_annuity(pmt, r, n) * (1 + r)
def fv_annuity_due(pmt, r, n):
"""Calculate the Future Value of an Annuity Due."""
return fv_ordinary_annuity(pmt, r, n) * (1 + r)
def pv_perpetuity(pmt, r):
"""Calculate the Present Value of a Perpetuity."""
if r <= 0:
raise ValueError("Discount rate must be greater than 0")
return pmt / r
def pv_growing_annuity(pmt_1, r, g, n):
"""Calculate the Present Value of a Growing Annuity."""
if r == g:
return (n * pmt_1) / (1 + r)
return (pmt_1 / (r - g)) * (1 - ((1 + g) / (1 + r))**n)
def fv_growing_annuity(pmt_1, r, g, n):
"""Calculate the Future Value of a Growing Annuity."""
if r == g:
return n * pmt_1 * (1 + r)**(n - 1)
return (pmt_1 / (r - g)) * ((1 + r)**n - (1 + g)**n)
def pv_growing_perpetuity(pmt_1, r, g):
"""Calculate the Present Value of a Growing Perpetuity."""
if r <= g:
raise ValueError("Discount rate (r) must be greater than growth rate (g)")
return pmt_1 / (r - g)Example Usage#
Calculate the required retirement nest egg for $5,000 monthly withdrawals over 25 years, with a 4% annual return:
monthly_withdrawal = 5000
monthly_rate = 0.04 / 12
total_periods = 25 * 12
required_nest_egg = pv_ordinary_annuity(monthly_withdrawal, monthly_rate, total_periods)
print(f"Required retirement nest egg: ${required_nest_egg:,.2f}")
# Output: Required retirement nest egg: $947,262.41Common Pitfalls & Best Practices#
Even small errors in these calculations can lead to massive financial losses. Avoid these common mistakes:
- Mismatched Periods and Rates: Always convert annual rates to periodic rates and total years to total periods to match your cash flow frequency. For example, a 6% annual rate for a monthly mortgage becomes 0.5% per month, with 360 periods for a 30-year loan. Using the annual rate directly will lead to payment errors of thousands of dollars per month.
- Using instead of : For growing annuities and perpetuities, the formula uses the first future cash flow, not the most recent past cash flow. Using the wrong PMT can lead to 5-10% valuation errors for stocks and retirement plans.
- Invalid Growing Perpetuity Inputs: Never set for a growing perpetuity—this produces negative or infinite values that have no real-world financial meaning.
- Timing Misalignments: Always confirm if cash flows are at the start or end of periods. Calculating an annuity due (e.g., rent) as an ordinary annuity will undervalue the cash flow stream by a factor of , leading to lost revenue for landlords or overpayments for tenants.
Conclusion#
Annuities and perpetuities are the backbone of modern finance, powering everything from mortgage calculations to stock valuation to retirement planning. The key takeaways to remember are:
- All calculations are built on the time value of money principle: a dollar today is worth more than a dollar tomorrow.
- Annuities are finite, while perpetuities run forever.
- Ordinary annuities have end-of-period payments, while annuity due payments are at the start of each period.
- Always match your discount rate and period count to your cash flow frequency, and use the first future cash flow for growing annuity/perpetuity calculations.
- The Python functions provided can be plugged directly into personal finance tools, robo-advisor scripts, or investment analysis workflows for fast, accurate calculations.
References#
- Ross, S. A., Westerfield, R. W., & Jaffe, J. (2024). Corporate Finance (14th ed.). McGraw-Hill Education.
- CFA Institute. (2026). CFA Program Curriculum Level 1: Quantitative Methods.
- Investopedia. (2026). Annuity vs. Perpetuity: What’s the Difference?
- Hilpisch, Y. (2023). Python for Finance: Analyze Big Financial Data (3rd ed.). O’Reilly Media.
- NerdWallet. (2026). 2026 DIY Investor Survey Report.