Understanding the bond convexity calculator — concept and principle
This calculator finds a bond's price, Macaulay duration, modified duration and convexity, and compares three estimates of the price change for a yield shift: duration only, duration plus convexity, and exact repricing. Use it for fixed-income courses, interest-rate risk management and understanding why bond prices react unevenly to rate rises and falls.
How it is calculated
With periodic yield i = YTM ÷ frequency and cash flow a_k at period k:
- Price P = Σ a_k (1 + i)^(−k).
- Macaulay duration = Σ k·a_k(1 + i)^(−k) ÷ P, converted to years by dividing by the frequency.
- Modified duration = Macaulay ÷ (1 + i).
- Convexity = Σ k(k + 1)·a_k(1 + i)^(−k−2) ÷ P, in years² after dividing by frequency².
- Price change ≈ −D_mod·Δy + ½·C·Δy².
It assumes today is a coupon date, so there is no accrued interest.
The principle
A bond's price is the present value of its cash flows, and that relationship with yield is a curve, not a straight line. Duration is the slope: the percentage price change for a small change in yield. Convexity measures the curvature. For a normal bond the curve bends upward, so when yields rise the price falls less than the straight-line duration estimate, and when yields fall it rises more. Adding the convexity term makes the estimate much closer to the exact answer for larger moves.
Worked example
Default inputs: face $1,000, coupon 5%, YTM 6%, 10 years, paid twice a year, yield change +1 point.
- 20 coupons of $25 at 3% per half-year give a price of $925.61.
- Macaulay duration = 7.89 years; modified duration = 7.89 ÷ 1.03 ≈ 7.67.
- Convexity ≈ 71.79 years².
- Duration only: −7.67 × 0.01 = −7.67%. With convexity: −7.67% + ½ × 71.79 × 0.0001 ≈ −7.31%.
- Exact repricing at 7%: $857.88, a change of −7.32%.
| Years to maturity | Convexity (years²) |
|---|---|
| 2.5 | 6.62 |
| 5 | 22.3 |
| 7.5 | 44.7 |
| 10 | 71.79 |
| 12.5 | 101.91 |
| 15 | 133.72 |
| 20 | 198.36 |
How to read the result
Higher duration means more price sensitivity to rates. Higher convexity is generally good for the holder: it cushions losses when yields rise and adds to gains when they fall. Long maturities and low coupons raise both duration and convexity. For small yield changes duration alone is enough; for larger ones, include convexity.
Common mistakes
- Mixing Macaulay and modified duration in the price formula.
- Entering the yield change in percent (1) where a decimal (0.01) is expected, or the reverse.
- Forgetting to convert periodic results to years.
- Applying these formulas to callable bonds, whose convexity can be negative.
Frequently asked questions
Why is convexity positive for a normal bond?
Because the price–yield curve bends upward, so prices rise more for a yield fall than they drop for an equal rise.
What is the difference between duration and convexity?
Duration is the first-order sensitivity to yield; convexity is the second-order correction for curvature.
Do zero-coupon bonds have convexity?
Yes, and for a given duration they have less convexity than coupon bonds with spread-out cash flows, but long zeros are very convex.
Sources: R. Alps, "Using Duration and Convexity to Approximate Change in Present Value", Society of Actuaries study note FM-24-17 (2017)