# Bond price, yield and duration calculator

> Calculate a bond's price from its yield to maturity, or the YTM from its price, with current yield, Macaulay and modified duration and convexity.

Interactive version: https://www.calcopenly.com/finance/bond-calculator
Subject: Finance calculators

A bond's price is the present value of its coupons and its face value, each discounted at the yield to maturity for the coupon period. With semi-annual coupons, a 5% coupon on 1,000 pays 25 every six months and the annual yield is halved per period, the bond-equivalent convention. Solving the same equation for the rate turns a market price into a yield. Duration is the present-value-weighted average time until the cash flows arrive; modified duration and convexity estimate how far the price moves when the yield changes.

With the defaults, a 10-year 5% semi-annual bond with a face value of 1,000, priced to yield 6%, is worth 925.61: a discount, because its coupon is below the yield. Its Macaulay duration is 7.895 years and its modified duration 7.665, so a 0.01% rise in yield lowers the price by about 0.71.

The price assumes settlement on a coupon date, so there is no accrued interest. Credit risk, call features and taxes are not modeled.

## Inputs

- **Solve for** (options: Price from yield, Yield from price)
- **Face value**
- **Coupon rate (per year)**
- **Years to maturity**
- **Coupons per year** (options: Annual, Semi-annual, Quarterly, Monthly)
- **Yield to maturity (per year)**
- **Market price**

## Results

- Price — main result
- Yield to maturity (annual, bond-equivalent)
- Effective annual yield
- Current yield
- Price as % of face
- Macaulay duration (years)
- Modified duration (years)
- Convexity (years²)
- Price change per 0.01% yield change

## Formula

$$
P = \sum_{t=1}^{n} \frac{c}{(1+y)^t} + \frac{F}{(1+y)^n},\quad D_{mac} = \frac{1}{P\,f}\sum_{t=1}^{n} \frac{t\,CF_t}{(1+y)^t},\quad D_{mod} = \frac{D_{mac}}{1+y}
$$

## Worked examples

### 10-year 5% semi-annual bond at 6%

- Solve for: Price from yield
- Face value: 1000
- Coupon rate (per year): 5%
- Years to maturity: 10 years
- Coupons per year: Semi-annual
- Yield to maturity (per year): 6%
- **Price: 925.61**
- **Macaulay duration: 7.894997 years**
- **Modified duration: 7.665046 years**
- **Convexity: 71.785398 years²**
- **Current yield: 5.401828%**
- Checked against: Python decimal (prec 50): cash flows discounted term by term; Fabozzi convexity Σt(t+1)PV/((1+y)²·P·f²); current yield 50/925.6126 = 5.4018278%

### Microsoft DURATION example

- Solve for: Price from yield
- Face value: 100
- Coupon rate (per year): 8%
- Years to maturity: 29.5 years
- Coupons per year: Semi-annual
- Yield to maturity (per year): 9%
- **Macaulay duration: 10.919145 years**
- **Modified duration: 10.448943 years**
- Checked against: Microsoft DURATION documentation (settlement 2018-07-01 is a coupon date, maturity 2048-01-01): 10.9191453; Python decimal agrees

### Microsoft MDURATION example

- Solve for: Price from yield
- Face value: 100
- Coupon rate (per year): 8%
- Years to maturity: 8 years
- Coupons per year: Semi-annual
- Yield to maturity (per year): 9%
- **Modified duration: 5.73567 years**
- **Price: 94.38**
- Checked against: Microsoft MDURATION documentation (2008-01-01 to 2016-01-01, a coupon date): 5.73567; Python decimal price 94.382992

### Par bond: coupon equals yield

- Solve for: Price from yield
- Face value: 1000
- Coupon rate (per year): 6%
- Years to maturity: 10 years
- Coupons per year: Semi-annual
- Yield to maturity (per year): 6%
- **Price: 1,000.00**
- **Price as % of face: 100%**
- Checked against: A bond whose coupon rate equals its yield prices at par (definition)

### Zero-coupon yield from price

- Solve for: Yield from price
- Face value: 1000
- Coupon rate (per year): 0%
- Years to maturity: 10 years
- Coupons per year: Annual
- Market price: 500
- **Yield to maturity (annual, bond-equivalent): 7.177346%**
- **Macaulay duration: 10 years**
- **Convexity: 95.760562 years²**
- Checked against: Closed form 2^(1/10) − 1 = 7.1773462536%; a zero's Macaulay duration equals its maturity; convexity n(n+1)/(1+y)² from Python decimal

### One annual period

- Solve for: Price from yield
- Face value: 1000
- Coupon rate (per year): 5%
- Years to maturity: 1 year
- Coupons per year: Annual
- Yield to maturity (per year): 5%
- **Price: 1,000.00**
- **Macaulay duration: 1 year**
- **Modified duration: 0.952381 years**
- **Convexity: 1.814059 years²**
- Checked against: 1050/1.05 = 1000; D = 1; D/(1.05) = 0.952381; 2/1.05² = 1.814059 (hand calculation)

## Questions

### How do you calculate the price of a bond?

Discount every coupon and the face value at the yield per period and add them. A 10-year 5% bond paying 25 twice a year, at a 6% yield (3% per half-year), is worth 371.94 for its 20 coupons plus 1,000 ÷ 1.03^20 = 553.68 for the face value: 925.61 in total. Excel's =PV(3%, 20, -25, -1000) gives the same price.

### What is the difference between yield to maturity and current yield?

Current yield is the annual coupon divided by the price; yield to maturity also counts the gain or loss to face value at maturity and the timing of every payment. A 5% bond bought at 925.61 has a current yield of 50 ÷ 925.61 = 5.40% but a yield to maturity of 6%, because the buyer also gains 74.39 when the bond repays 1,000.

### Why do bond prices fall when interest rates rise?

The coupons are fixed, so a higher yield discounts the same payments more heavily. The default 10-year 5% bond is worth 1,081.76 at a 4% yield, exactly 1,000 at 5%, 925.61 at 6% and 857.88 at 7%. When the yield equals the coupon rate the bond trades at par; above it, at a discount; below it, at a premium.

### What does bond duration tell you?

Modified duration is the approximate percentage change in price for a one-percentage-point change in yield. The default bond's modified duration is 7.665, so a rise from 6% to 7% should cut the price by about 7.67%; the actual fall, from 925.61 to 857.88, is 7.32%, because convexity cushions large moves. Macaulay duration, 7.895 years here, is the weighted average time to the cash flows.

### How often do US Treasury notes and bonds pay interest?

Every six months. The US Treasury issues notes with terms of 2, 3, 5, 7 and 10 years and bonds with terms of 20 and 30 years, and both pay interest semi-annually, which is why this page defaults to two coupons a year. Choose annual, quarterly or monthly coupons for bonds that pay on another schedule.

### How accurate is the bond price, yield and duration calculator?

Accuracy depends on your inputs and the method's assumptions. Decimal arithmetic uses 50 significant digits, but estimates, numerical methods and source data can be less precise; the displayed rounding does not remove those limits. It is checked against 7 worked examples whose answers come from independent sources; for example, “10-year 5% semi-annual bond at 6%” is checked against Python decimal (prec 50): cash flows discounted term by term; Fabozzi convexity Σt(t+1)PV/((1+y)²·P·f²); current yield 50/925.6126 = 5.4018278%.

### Where does the method come from?

Microsoft Excel DURATION function; Microsoft Excel MDURATION function; Fabozzi — Bond Markets, Analysis, and Strategies, ch. 2 and 4 (pricing, duration, convexity).

## Sources

- [Microsoft Excel DURATION function](https://support.microsoft.com/office/duration-function-b254ea57-eadc-4602-a86a-c8e369334038)
- [Microsoft Excel MDURATION function](https://support.microsoft.com/office/mduration-function-b3786a69-4f20-469a-94ad-33e5b90a763c)
- Fabozzi — Bond Markets, Analysis, and Strategies, ch. 2 and 4 (pricing, duration, convexity)

_Note: financial information, not professional advice._
