A bond yield calculator that handles both directions of fixed-income arithmetic: give it a market price and it returns the yield to maturity (YTM); give it a YTM and it prices the bond. Either way you also get Macaulay duration, modified duration, convexity, and DV01 — the four numbers that every fixed-income investor needs to understand interest-rate risk. A full coupon cash-flow schedule and a yield-sensitivity table round out the toolkit. Everything runs in your browser; no data is sent anywhere.
How it works
Bond pricing
A fixed-rate bond pays a regular coupon and returns the face (par) value at maturity.
Its fair price is the sum of the present values of all those cash flows, discounted at
the yield to maturity y (per period):
P = C * [1 - (1+y)^(-n)] / y + FV * (1+y)^(-n)
where C is the coupon per period (annual coupon divided by payments per year), y is
the periodic YTM (annual YTM divided by payments per year), n is the total number of
coupon periods (years times payments per year), and FV is the face value. The first
term is the present value of the coupon stream (an ordinary annuity); the second is the
present value of the par repayment.
Solving for YTM
When price is known, YTM has no closed-form solution — it is the root of
f(y) = P(y) - market_price = 0. This calculator uses
Newton-Raphson iteration seeded with the classic YTM approximation
y ≈ (annual coupon + (FV - price) / years) / ((FV + price) / 2), switching
to bisection if Newton overshoots. Convergence to eight decimal places
typically takes fewer than 20 iterations across all realistic market prices.
Duration and convexity
Macaulay duration is the weighted average time to receive the bond’s cash flows, where each weight is that cash flow’s share of the total present value. It tells you, in years, when you “effectively” get your money back.
Modified duration equals Macaulay duration divided by (1 + y). It gives the
percentage price change per unit change in yield:
dP/P ≈ -ModD * dy.
Convexity accounts for the curvature of the price-yield relationship, improving
the approximation for large yield moves:
dP/P ≈ -ModD * dy + 0.5 * Cx * dy^2.
DV01 (dollar value of 01, also called PVBP) is ModD * P * 0.0001 — the dollar
price change for a one-basis-point move in yield.
Worked example
Consider a $1,000 par, 5% annual coupon, 10-year bond paying semi-annually, currently trading at $950:
- Semi-annual coupon C = 1000 times 0.05 / 2 = $25
- Periods n = 10 times 2 = 20
- Solving f(y) = 0 gives periodic y ≈ 0.02732, so annual YTM ≈ 5.464%
- Current yield = 50 / 950 = 5.26% (lower than YTM because of the pull-to-par capital gain as the discount narrows to zero)
- Macaulay duration ≈ 7.99 years, Modified duration ≈ 7.78 years
- DV01 ≈ $0.738 per basis point
The sensitivity table confirms: if yields rise 100 bp, the approximated price falls by roughly $73.80 (minus the convexity offset), landing around $876.
| Market Price | YTM | Current Yield | Mod. Duration | DV01 |
|---|---|---|---|---|
| $950 (discount) | 5.46% | 5.26% | 7.78 yrs | $0.74 |
| $1,000 (par) | 5.00% | 5.00% | 7.79 yrs | $0.78 |
| $1,050 (premium) | 4.56% | 4.76% | 7.80 yrs | $0.82 |
| $900 (deep discount) | 5.97% | 5.56% | 7.74 yrs | $0.70 |
Notice that as price falls, YTM rises (inverse relationship) and DV01 falls (you own a smaller dollar amount of sensitivity per bond).