Skip to main content

calcfi-mortgage-payment

Standard amortizing-loan monthly payment formula. Free, cited, MIT.

CalcFi Mortgage Payment Calculator — a single-purpose, MIT-licensed helper for Compute the monthly principal and interest payment for a fixed-rate mortgage using the standard amortization formula P × [r(1+r)^n] / [(1+r)^n − 1]. Rates sourced from Freddie Mac PMMS via FRED MORTGAGE30US.

License: MIT ORCID CalcFi

What this does

Compute the monthly principal and interest payment for a fixed-rate mortgage using the standard amortization formula P × [r(1+r)^n] / [(1+r)^n − 1]. Rates sourced from Freddie Mac PMMS via FRED MORTGAGE30US.

Formula — Standard amortizing-loan formula:

M = P × [r(1+r)^n] / [(1+r)^n − 1]

Primary source: Freddie Mac PMMS via FRED MORTGAGE30US

Install

pip install calcfi-mortgage-payment

Usage

from calcfi_mortgage_payment import monthly_payment, total_interest

# $400,000 loan at 6.5% for 30 years
m = monthly_payment(400_000, 0.065, 30)
# 2528.27

ti = total_interest(400_000, 0.065, 30)
# ~510,180

Live calculator

Try the interactive web calculator with full UI at https://calcfi.app/calculators/mortgage-payment — no signup required.

Why this package exists

Most personal-finance calculators are buried in advertising-heavy lead-generation sites. The math is freely published by federal agencies and textbooks, but the implementations are wrapped in proprietary opaque code. CalcFi publishes these utility libraries to make every formula:

  1. Reproducible — show the math
  2. Cited — link to primary sources
  3. Free — MIT license, no paid tier
  4. Auditable — every line of code is open source

The math here is undergraduate-level. The contribution is the citation discipline and the open distribution.

Part of the CalcFi ecosystem

This package is one of 8 single-purpose helper utilities. Cross-mesh:

Sibling Python packages

  • calcfi-compound-interest — Compound interest with periodic contributions. Future value, present value, time-to-target. Free, MIT.
  • calcfi-rule-of-72 — Rule of 72 — approximate years to double an investment at a given rate. Plus exact ln(2) version. MIT.
  • calcfi-apr-apy — Convert between APR (simple annual rate) and APY (effective annual yield including compounding). MIT.
  • calcfi-real-return — Inflation-adjusted (real) return from nominal return. Formula: real = (1+nominal)/(1+inflation) − 1. MIT.
  • calcfi-amortization — Generate a full amortization schedule for a fixed-rate loan: payment, principal, interest, balance per period. MIT.
  • calcfi-tax-bracket — US federal income tax bracket math — marginal rate, effective rate, total tax owed. 2024-2026 brackets per IRS Rev. Proc. MIT.
  • calcfi-debt-payoff — Snowball vs avalanche debt payoff strategies. Compute months and total interest. MIT.

Sibling npm packages

  • calcfi-compound-interest — Compound interest with periodic contributions. Future value, present value, time-to-target. Free, MIT.
  • calcfi-rule-of-72 — Rule of 72 — approximate years to double an investment at a given rate. Plus exact ln(2) version. MIT.
  • calcfi-apr-apy — Convert between APR (simple annual rate) and APY (effective annual yield including compounding). MIT.
  • calcfi-real-return — Inflation-adjusted (real) return from nominal return. Formula: real = (1+nominal)/(1+inflation) − 1. MIT.
  • calcfi-amortization — Generate a full amortization schedule for a fixed-rate loan: payment, principal, interest, balance per period. MIT.
  • calcfi-tax-bracket — US federal income tax bracket math — marginal rate, effective rate, total tax owed. 2024-2026 brackets per IRS Rev. Proc. MIT.
  • calcfi-debt-payoff — Snowball vs avalanche debt payoff strategies. Compute months and total interest. MIT.

Companion data

The mortgage rate, inflation, Treasury yield, and macro data used to validate these calculators are published as CalcFi Open Data — 34 free CC BY 4.0 time series, 117,956 observations, 5 permanent DOIs.

Calculators on CalcFi (free, no signup)

Every formula in these packages has a live web calculator at calcfi.app:

License

MIT. Author: Jere Salmisto (ORCID 0009-0000-0916-8684), founder of CalcFi. Based in Helsinki, Finland.

Citation

If you cite this package in research:

Salmisto, J. (2026). calcfi-mortgage-payment: CalcFi Mortgage Payment Calculator.
DOI: 10.6084/m9.figshare.32332290 (parent CalcFi Open Data dataset).
Available: https://calcfi.app/calculators/mortgage-payment

Or use the CITATION.cff on the parent dataset for the BibTeX entry.

Metadata

Release files for calcfi-mortgage-payment 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for calcfi-mortgage-payment 0.1.0
File Size Uploaded
calcfi_mortgage_payment-0.1.0.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for calcfi-mortgage-payment 0.1.0
File Interpreter ABI Platform
calcfi_mortgage_payment-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / calcfi_mortgage_payment-0.1.0.tar.gz

Download URL calcfi_mortgage_payment-0.1.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4c6935579127c89193e0b760975b76a83977d94db69fa4cee41ab487e099a95d
BLAKE2b-256 checksum
How to use checksums
edd17976e01149af6d5bca828c4ad3135b887edf9df913b44de3d066615f2fca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / calcfi_mortgage_payment-0.1.0-py3-none-any.whl

Download URL calcfi_mortgage_payment-0.1.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8d9efba008ef4a883c9a1581b68255bc78caabd8b45034cdc1e52947d509a21
BLAKE2b-256 checksum
How to use checksums
ac994f1ab902c908ea87a3541071bacce46e1bd20859cc7799226cecf9e66988
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page