Bond Immunization Visualizer

Bond immunization is a portfolio strategy that protects a fixed liability from interest-rate risk by matching the bond's Macaulay duration to the investor's liability horizon. When duration equals the horizon, two opposing forces — price risk and reinvestment risk — cancel each other out, leaving the accumulated portfolio value nearly unchanged after a rate shock.

The bond price is $$P = \sum_{t=1}^{T} \frac{C}{(1+y)^t} + \frac{F}{(1+y)^T}$$ Macaulay duration is the present-value-weighted average time of cash flows: $$D_{\text{mac}} = \sum_{t=1}^{T} t \cdot \frac{CF_t / (1+y)^t}{P}$$ After a rate shock from \(y\) to \(r = y + \Delta y\), the accumulated portfolio value at horizon \(H\) is: $$V(r, H) = n \times \left[\sum_{t \leq H} CF_t\,(1+r)^{H-t} + \sum_{t > H} \frac{CF_t}{(1+r)^{t-H}}\right]$$ where \(n\) is the number of bonds purchased. Surplus \(= V(r,H) - L\).

Liability
$10,000
7 yrs
Bond Characteristics
6.00%
5.00%
10 yrs
Face value (F): $1,000
Interest Rate Shock
0 bps
Horizon exceeds bond maturity — not immunizable.

Bond & Portfolio

Bond price (P)
Macaulay duration (Dmac)
Modified duration (Dmod)
Duration gap (D − H)
Initial investment (W)
Number of bonds (n)
Accumulated value at H
Liability (L)
Surplus ($)
Surplus (%)
Set the liability horizon and adjust the bond's maturity and coupon to match the Macaulay duration to the horizon. Then move the rate shock slider to see immunization in action.
Surplus curve
Zero surplus

Key Takeaways

  1. Immunization eliminates first-order interest-rate risk. When a bond portfolio's Macaulay duration equals the investor's horizon, price risk and reinvestment risk offset each other for any small, parallel rate shift. The surplus curve is flat near the current yield, meaning the liability is met regardless of small rate movements.
  2. The duration gap measures immunization quality. A duration gap of zero is the immunization target. Positive gaps mean duration exceeds the horizon — rising rates then help reinvestment more than they hurt price, leaving a surplus. Negative gaps mean the reverse. Only when the gap is near zero are the two forces balanced.
  3. Price risk and reinvestment risk are the two opposing forces. A rate rise lowers the bond's market price at the horizon but raises the rate at which coupons are reinvested. A rate fall does the opposite. Matching duration to the horizon is the condition under which these two effects precisely cancel.
  4. Immunization is only approximate for large shocks. Because duration is a linear measure, it only guarantees protection for infinitesimally small rate changes. For large shocks, convexity effects cause the surplus curve to bow upward (immunization is "self-correcting" — actual surplus is usually positive even after large shocks when duration is matched), but this cannot be taken for granted after structural shifts.
  5. Practical limitations. Real-world immunization requires (a) the bond maturity to exceed the horizon, (b) continuous rebalancing as duration drifts over time, (c) parallel yield-curve shifts (non-parallel shifts can break the hedge), and (d) sufficient bond supply. Zero-coupon bonds offer the cleanest immunization since their Macaulay duration equals maturity exactly.

← Return to Investment Management Materials