Skip to content

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.

Table 1. Price and interest-rate risk, priced on a coupon date (no accrued interest).
MeasureValueUnit
Price1,000.0000currency units
Price as % of face100.0000%
Macaulay duration2.8594years
Modified duration2.7232% price change per 1 point of yield
Convexity10.2056years²
DV01 (price value of a basis point)0.2723currency 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
Table 2. Each cash flow, its present value and its weight in the Macaulay duration.
t (years)Cash flowPresent valueWeight
150.0047.61900.047619
250.0045.35150.045351
31,050.00907.02950.907029

2. The formulas

P = Σ CF_k / (1 + i)^k
Equation 1. Price: each cash flow CF_k discounted at the periodic yield i = y / f, for k = 1 … n periods.
D_mac = Σ (k / f) · PV_k / P
Equation 2. Macaulay duration, in years: the present-value-weighted average time of the cash flows.
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²
Equation 3. Modified duration and convexity, and the price change they predict for a yield change Δ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

  1. 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.
  2. 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.
  3. Macaulay: (1 × 47.619048 + 2 × 45.351474 + 3 × 907.029478) / 1,000 = 2,859.410430 / 1,000 = 2.8594 years.
  4. 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.
  5. 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.
  6. 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.2056
Listing 1. Price, durations and convexity in NumPy; it prints the worked example's numbers.

5. 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.

Code it yourself, free, in your browser

More: all calculators · every formula on one page