Home / Tools / Bond duration calculator
Bond duration calculator
By Sitraka Forler · Lecturer, Durham Business SchoolUpdated 16 October 2026 About this site
Duration measures how far a bond's price moves when yields move. Enter the face value, coupon, yield and maturity to get the price, the Macaulay duration (a time, in years), the modified duration (a sensitivity, in % per point of yield), the convexity that corrects it, and the DV01.
Free, no sign-up. Everything is computed in your browser: nothing you type is sent anywhere. Educational tool, not investment advice.
1. Calculator
0 for a zero-coupon bond.
Compounded at the coupon frequency.
| Measure | Value | Unit |
|---|---|---|
| Price | 1,000.0000 | currency units |
| Price as % of face | 100.0000 | % |
| Macaulay duration | 2.8594 | years |
| Modified duration | 2.7232 | % price change per 1 point of yield |
| Convexity | 10.2056 | years² |
| DV01 (price value of a basis point) | 0.2723 | currency units |
A 1 percentage point rise in yield moves the price by about −2.72% from duration alone, and by −2.672% once convexity is added.
Show the 3 discounted cash flows
| t (years) | Cash flow | Present value | Weight |
|---|---|---|---|
| 1 | 50.00 | 47.6190 | 0.047619 |
| 2 | 50.00 | 45.3515 | 0.045351 |
| 3 | 1,050.00 | 907.0295 | 0.907029 |
2. The formulas
P = Σ CF_k / (1 + i)^k
D_mac = Σ (k / f) · PV_k / P
D_mod = D_mac / (1 + i) C = Σ CF_k · k(k + 1) / (1 + i)^(k + 2) / (P · f²) ΔP/P ≈ −D_mod · Δy + ½ · C · Δy²
f is the number of coupons a year and n = f × maturity. The bond is priced on a coupon date, so there is no accrued interest and the clean and dirty prices are equal. DV01 is D_mod × P × 0.0001: the money a one basis point fall in yield adds to the price.
Duration is the slope of the price-yield curve and convexity its curvature. For small moves the slope is enough; for a 100 basis point move on a long bond the curvature term is worth real money, always in the holder's favour for a plain bond. The bond duration page shows the same example moved both ways.
3. Worked example
- A €1,000 bond with a 5% annual coupon, three years to maturity, priced at a 5% yield. Cash flows: €50, €50 and €1,050.
- Present values: 50 / 1.05 = 47.619048; 50 / 1.1025 = 45.351474; 1,050 / 1.157625 = 907.029478. They sum to €1,000.00: a bond whose coupon equals its yield prices at par.
- Macaulay: (1 × 47.619048 + 2 × 45.351474 + 3 × 907.029478) / 1,000 = 2,859.410430 / 1,000 = 2.8594 years.
- Modified: 2.859410 / 1.05 = 2.7232, so about −2.72% for a one point rise in yield. DV01 = 2.723248 × 1,000 × 0.0001 = €0.2723.
- Convexity: (2 × 50 / 1.05³ + 6 × 50 / 1.05⁴ + 12 × 1,050 / 1.05⁵) / 1,000 = (86.383760 + 246.810742 + 9,872.429698) / 1,000 = 10.2056.
- At 6%, duration alone predicts −2.7232% (−€27.23); with convexity, −2.7232% + ½ × 10.2056 × 0.0001 = −2.7232% + 0.0510% = −2.6722% (−€26.72). Repricing at 6% gives €973.27, a fall of €26.73.
Duration alone is off by 50 cents on a 100 basis point move; with convexity the estimate is within one cent of the true price. Load the example above and switch to semi-annual coupons to see how the frequency changes each figure.
4. The Python behind it
import numpy as np
face, coupon, y, years, f = 1000, 0.05, 0.05, 3, 1 # f = coupons a year
k = np.arange(1, years * f + 1) # period numbers 1..n
cf = np.full(k.size, face * coupon / f)
cf[-1] += face # principal with the last coupon
i = y / f
pv = cf / (1 + i) ** k
price = pv.sum()
macaulay = (k / f * pv).sum() / price # years
modified = macaulay / (1 + i)
convexity = (cf * k * (k + 1) / (1 + i) ** (k + 2)).sum() / (price * f**2)
print(f"{price:.2f} {macaulay:.4f} {modified:.4f} {convexity:.4f}")
# 1000.00 2.8594 2.7232 10.20565. Reading the result
- A zero-coupon bond's Macaulay duration equals its maturity; coupons pull it shorter, and a higher coupon pulls it further.
- Higher yields shorten duration, because distant cash flows are discounted harder and weigh less.
- Modified duration assumes the cash flows do not change with yields. Callable bonds and mortgage-backed securities need effective duration instead.
- The yield here is compounded at the coupon frequency, the usual bond-market convention. A yield quoted with another compounding must be converted first.
Learn the concept
- Bond Duration: A bond's price sensitivity to interest-rate changes.