Quick Answer: A $1,000 face, 5% semiannual-coupon bond with 10 years to maturity priced to a 6% yield has a modified duration of 7.67 years, a Macaulay duration of 7.89 years, a convexity of 71.79 and a price of $925.61. At a +100 basis point shock, duration alone predicts a $70.95 loss, the convexity correction adds back $3.32 for a $67.63 estimate, and the bond fully repriced at 7% actually falls $67.73.
Overview
Modified duration is the single number a bond desk uses to answer "what happens to this price if yields move". It is the percentage price change per one percentage point of yield movement, and it is negative by convention: prices fall when yields rise.
It is also a first-order approximation. The relationship between price and yield is a convex curve, not a straight line, and modified duration is the tangent to that curve at the current yield. Follow a tangent far enough from the point of contact and it drifts away from the curve in one consistent direction. Because the price-yield curve is convex for an ordinary bond, the tangent always sits below the true curve. Duration alone therefore under-predicts the gain from a rate fall and over-predicts the loss from a rate rise.
Convexity is the second-order correction that closes most of that gap. It is why bond desks quote both figures, and why convexity is treated as a desirable property rather than a technicality: for an ordinary bond the correction is positive whichever direction rates move, because the term is scaled by the square of the yield change.
This calculator computes duration, convexity and the price from first principles, then puts three answers side by side at your chosen shock: what duration alone says, what duration plus convexity says, and what the bond is actually worth when fully re-discounted at the new yield. The two error columns show how much each approximation left on the table.
How This Is Calculated
Every cash flow is discounted individually. Nothing is interpolated.
Step 1 -- Build the cash flow schedule. The number of periods is years to maturity multiplied by the coupon frequency, rounded. Each period pays face value times the coupon rate divided by the frequency, and the final period adds the face value.
Step 2 -- Discount each cash flow. The periodic yield is the annual yield divided by the frequency. Each cash flow is divided by one plus that rate raised to its period number, and the sum is the price.
Step 3 -- Accumulate the duration numerator. Each cash flow's present value is multiplied by its period number and summed.
Step 4 -- Compute Macaulay duration in years. That numerator divided by price, then divided by the coupon frequency to convert periods into years.
Step 5 -- Convert to modified duration. Macaulay duration divided by one plus the periodic yield.
Step 6 -- Accumulate the convexity numerator. Each cash flow's present value multiplied by $t(t+1)$, summed, then divided by price, by the frequency squared, and by the square of one plus the periodic yield.
Step 7 -- Compute DV01. Price multiplied by modified duration, divided by 10,000. This is the dollar price change for a one basis point yield move.
Step 8 -- Apply the duration-only estimate. The negative of modified duration multiplied by the yield shift in decimal, multiplied by the price.
Step 9 -- Add the convexity term. One half of convexity multiplied by the square of the yield shift, added to the duration term before multiplying by price. The difference between this and step 8 is the convexity correction.
Step 10 -- Reprice the bond exactly. The entire cash flow schedule is re-discounted at the shocked yield from scratch, using the same pricer. The difference from the original price is the true answer.
Step 11 -- Report both errors. Exact change less the duration-only estimate, and exact change less the duration-plus-convexity estimate.
The accrued-interest fraction is fixed at zero in this calculator, so the clean and dirty prices are identical, and every duration figure is computed on that price.
Worked Example
Defaults: $1,000 face, 5% annual coupon paid semiannually, 6% yield to maturity, 10 years, +100 bps shock.
Step 1 -- Find the periodic terms. 20 periods, a coupon of $1,000 × 5% ÷ 2 = $25 per period, and a periodic yield of 6% ÷ 2 = 3.00%
Step 2 -- Discount every cash flow and sum. Nineteen coupons of $25 plus a final $1,025, discounted at 3% per period = $925.61
The bond trades below par because its 5% coupon is below the 6% market yield.
Step 3 -- Compute Macaulay duration. The present-value-weighted average time to cash flow is 7.8950 years
Step 4 -- Convert to modified duration. 7.8950 ÷ 1.03 = 7.6650 years
Step 5 -- Compute convexity. 71.7854
Step 6 -- Compute DV01. $925.61 × 7.6650 ÷ 10,000 = $0.71 per basis point
Step 7 -- Estimate the price change from duration alone. −7.6650 × 0.01 = −7.665%, and $925.61 × −7.665% = −$70.95
Step 8 -- Compute the convexity correction. 0.5 × 71.7854 × (0.01)² = 0.003589, and $925.61 × 0.3589% = +$3.32
Step 9 -- Combine the two terms. −$70.95 + $3.32 = −$67.63, a −7.31% price change
Step 10 -- Reprice the bond exactly at 7%. Re-discounting all 20 cash flows at 3.50% per period gives $857.88, a change of −$67.73
Step 11 -- Compare the errors. Duration alone: −$67.73 − (−$70.95) = $3.22 too pessimistic With convexity: −$67.73 − (−$67.63) = −$0.10 remaining, roughly a thirtieth of the error
What This Does Not Account For
- Parallel shifts only. The yield shock is applied uniformly to the single yield to maturity. Real curves twist, steepen and flatten, and a portfolio hedged on parallel-shift duration is not hedged against a twist. Key rate durations are not computed here.
- No accrued interest. The settlement fraction is fixed at zero, so the clean and dirty prices are equal and every figure sits on a coupon date. A bond priced between coupon dates has a different dirty price and a slightly different duration.
- No option features. Callable, putable and convertible bonds have effective duration and can have negative convexity. This is a plain bullet bond model, and applying it to a callable bond will overstate duration once the bond trades near its call price.
- No credit risk or spread duration. Everything is discounted at one yield. Spread-driven price moves are not separated from rate-driven ones.
- No amortising or floating-rate structures. Mortgage-backed cash flows, sinking funds and floaters are outside the model.
- Third-order and beyond. The estimate stops at the convexity term. The residual $0.10 at a 100 bps shock is that omission, and it grows with the cube of the yield move.
- Rounding. Duration and convexity are carried at high precision; prices and dollar changes are rounded to the cent at each reporting step, so the two error columns can differ by a cent from a hand calculation.
- The yield you enter is not sourced. No market data is embedded in this page.
Common Pitfalls
Treating modified duration as a percentage rather than a per-unit-yield sensitivity. A duration of 7.67 does not mean the bond falls 7.67%. It means it falls about 7.67% per 100 basis points. At a 25 bps move the estimate is roughly a quarter of that.
Using duration alone for large shocks. At 100 bps the duration-only error here is $3.22 on a $925.61 bond. Because the error scales with the square of the move, a 300 bps shock leaves an error roughly nine times as large. This is exactly why 2022 losses on long bonds surprised people who had only ever stress-tested small moves.
Confusing Macaulay and modified duration. Macaulay duration (7.89 years) is a weighted average time. Modified duration (7.67 years) is a price sensitivity. They differ by the factor $1 + y/f$, which grows as yields rise, so the gap widens in a high-rate environment.
Assuming a higher coupon means more rate risk. The opposite is true. A lower coupon pushes more of the bond's value out to the maturity payment, which lengthens duration. A 30-year 2% bond is the highest-duration ordinary shape there is.
Reading convexity as protection against loss. Convexity does not make losses smaller than they would otherwise be; it makes them smaller than duration alone predicts. The bond still falls $67.73 here.
Forgetting frequency. Semiannual is the US Treasury and corporate convention; most European government bonds pay annually. Changing the frequency changes the periodic discount rate and therefore both duration figures.
Frequently Asked Questions
What is the difference between Macaulay and modified duration?
How much does my bond fall if rates rise 1%?
Why is convexity always a good thing to have?
What is DV01 and how is it different from duration?
Does a bond's face value change its duration?
Why does the exact repricing differ from the estimate at all?
Sources
Modified duration is a closed-form definition rather than a published rate, so this page cites no statutory source. The implementation is in engine/primitives/bonds.ts and is covered by golden vectors in engine/vectors/bonds.test.ts.
- Macaulay duration: $D_{mac} = \left(\sum_t t \cdot PV(CF_t)\right) / (P \times f)$, in years.
- Modified duration: $D_{mod} = D_{mac} / (1 + y/f)$.
- Convexity: $C = \left(\sum_t t(t+1) \cdot PV(CF_t)\right) / (P \times f^2 \times (1+y/f)^2)$.
- Second-order price approximation: $\Delta P / P \approx -D_{mod}\,\Delta y + \tfrac{1}{2} C (\Delta y)^2$.
- Face value, coupon, yield, maturity, frequency and the yield shock are all user inputs. No market data is embedded in this calculator.