Home › Investing & Real Estate › Bond Duration Calculator
Bond Duration Calculator
Prices a fixed-coupon bond from its yield to maturity and computes Macaulay duration, modified duration, convexity, DV01 and the estimated price change for a 1 percentage-point rise in yield.
When to use
You want to know how sensitive a bond's price is to interest-rate changes, or need duration and convexity for hedging or portfolio matching.
Do not use when: You know the price and want the yield (use bond-yield), or the bond is callable, floating-rate or amortizing. Informational only; not financial advice.
Formula
y = yield/m per period, n = years × m, C = face × coupon/m; P = Σ_{t=1..n} CF_t/(1+y)^t; D_mac = Σ t·PV_t / (P·m); D_mod = D_mac / (1 + y); convexity = Σ t(t+1)·PV_t / (P·(1+y)²·m²); ΔP/P ≈ −D_mod·Δy + ½·convexity·Δy²
Standard bond mathematics with level coupons at the end of each period and settlement on a coupon date (no accrued interest); the yield is nominal annual compounded m times a year. Informational mathematics only; not financial advice.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
face_value | number | default 1000 | Amount repaid at maturity. Range: > 0, ≤ 1000000000000 | |
coupon_rate_percent | number | % per year | yes | Annual coupon as a percent of face value. Range: ≥ 0, ≤ 100 |
yield_to_maturity_percent | number | % per year | yes | Nominal annual yield, compounded once per coupon period. Range: ≥ -10, ≤ 100 |
years_to_maturity | number | years | yes | Time until redemption; rounded to whole coupon periods. Range: > 0, ≤ 100 |
coupons_per_year | enum: annual | semiannual | quarterly | monthly | default semiannual | Coupon payment frequency (2 for US Treasuries and most corporates, 1 for many European bonds). |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
price | number | Present value of coupons and face value at the yield. | |
number_of_coupons | integer | round(years_to_maturity × coupons per year). | |
macaulay_duration_years | number | years | PV-weighted average time to each cash flow. |
modified_duration_years | number | years | Macaulay duration / (1 + y/m): percent price change per 1 unit (100 %) change in yield. |
convexity | number | years² | Σ t(t+1)·PV_t / (P·(1 + y/m)²·m²). |
dv01 | number | modified_duration × price × 0.0001: price change per 0.01 % yield move. | |
price_change_for_1pct_yield_rise_percent | number | % | −modified_duration × 1. |
price_change_for_1pct_yield_rise_with_convexity_percent | number | % | (−modified_duration × 0.01 + ½ × convexity × 0.01²) × 100. |
current_yield_percent | number | % | Annual coupon / price × 100. |
Example
5 % annual coupon, 5 % yield, 3 years, face 1,000: {"face_value":1000,"coupon_rate_percent":5,"yield_to_maturity_percent":5,"years_to_maturity":3,"coupons_per_year":"annual"} → {"price":1000,"number_of_coupons":3,"macaulay_duration_years":2.8594,"modified_duration_years":2.7232,"convexity":10.2056,"dv01":0.2723,"price_change_for_1pct_yield_rise_percent":-2.72,"price_change_for_1pct_yield_rise_with_convexity_percent":-2.67,"current_yield_percent":5}
6 % semiannual coupon, 8 % yield, 10 years: {"face_value":1000,"coupon_rate_percent":6,"yield_to_maturity_percent":8,"years_to_maturity":10,"coupons_per_year":"semiannual"} → {"price":864.1,"number_of_coupons":20,"macaulay_duration_years":7.4543,"modified_duration_years":7.1675,"convexity":65.044,"current_yield_percent":6.94}
GET https://tttkmbb.com/api/v1/calculate/bond-duration?face_value=1000&coupon_rate_percent=5&yield_to_maturity_percent=5&years_to_maturity=3&coupons_per_year=annual
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/bond-duration(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/bond-duration · Markdown: https://tttkmbb.com/investing/bond-duration.md · JSON definition: https://tttkmbb.com/investing/bond-duration.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="bond-duration" - OpenAPI operationId:
calculate_bond_duration - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- Wikipedia – Bond duration (reference)
- Wikipedia – Bond convexity (reference)
FAQ
What is the difference between Macaulay and modified duration?
Macaulay duration is a weighted average time in years; modified duration divides it by (1 + y/m) and gives the percentage price change for a 1-point yield change, which is what risk managers use.
Why add convexity?
Duration is a straight-line estimate; the price-yield curve bends upward, so the duration-only estimate overstates losses when yields rise and understates gains when they fall. Convexity corrects part of that error.
Related calculators
- Bond Yield Calculator — Solve for the yield when the price is known.
- Present Value Calculator — Discounting of a single cash flow.
- NPV Calculator — Present value of an arbitrary cash-flow list.