Macaulay and modified duration of a fixed-rate bond

A plain fixed-rate bond valued on a coupon date, with the yield compounded at the coupon frequency. The page reports the clean price per 100 of face as a check, then Macaulay and modified duration in years. This is not a convexity, key-rate, or portfolio duration calculator, and not a dealer quote.

The bond

Formulas

c = coupon / k, y = yield / k, n = years × k

P = 100 × [ c/y + (1 − c/y) × (1 + y)^−n ]

D_mac = [ (1 + y)/y − (1 + y + n(c − y)) / (c((1 + y)^n − 1) + y) ] / k

D_mod = D_mac / (1 + y)

Where k = coupons per year; c = coupon rate per period, as a decimal; y = yield per period, as a decimal; n = number of coupon periods to maturity; P = price per 100 of face, on a coupon date; D_mac = Macaulay duration in years, the present-value-weighted average time to the cash flows; D_mod = modified duration in years, the approximate percentage price change for a 1 percentage point change in yield.

The closed form is the sum of t × PV(cash flow at t) divided by the price, written without a loop. At a 0% yield the page uses the direct sums instead.

Duration does not depend on the face amount, so none is asked for.

For a zero-coupon bond, Macaulay duration equals the time to maturity.

Checked examples

A 5% semiannual bond with 10 years left, yielding 4.5%, prices at about 103.99 per 100. Macaulay duration is about 8.036 years and modified duration about 7.859.

A 3% semiannual bond at a 3% yield is priced at par. Its Macaulay duration is about 4.680 years, a little under its 5-year term because coupons arrive earlier.

A 10-year zero-coupon bond at 5% compounded semiannually costs about 61.03 per 100. Its Macaulay duration is exactly 10 years and its modified duration is 10 / 1.025, about 9.756.

Limits

Valuation is on a coupon date, so there is no accrued interest and no stub period. A term that is not a whole number of coupon periods is refused. Coupons are level and paid in full; no default, call, or put is modelled. Modified duration is a first-order estimate. For large yield moves, convexity matters and is not shown. Not for: settlement between coupon dates, accrued interest, or dirty prices; convexity, key-rate, or effective duration; callable, putable, floating-rate, or inflation-linked bonds; portfolio duration.

Bond duration, Wikipedia and Duration, Investor.gov glossary (U.S. SEC).