Tabellab

Yield Spreads & the Z-Spread: Pricing Credit Risk over Treasuries

Lesson 1 of 20Lab

All lessons
  1. Yield Spreads & the Z-Spread: Pricing Credit Risk over TreasuriesLabFree
  2. The Credit Triangle: Spread ≈ PD × LGDLab Locked
  3. Hazard Rates: Survival and Cumulative Default Probabilities with EXPLab Locked
  4. The CDS Premium Leg: Quarterly Payments × Survival × DiscountLab Locked
  5. The CDS Protection Leg: Expected Default Payments in Present ValueLab Locked
  6. The Fair CDS Spread: Protection PV / Risky Annuity, and the UpfrontLab Locked
  7. Mark-to-Market of an Existing CDS When Spreads MoveLab Locked
  8. The CDS-Bond Basis: When CDS and Bond Spreads DisagreeLab Locked
  9. Bootstrapping a Hazard Curve from the CDS Term StructureLab Locked
  10. Accrued Premium on Default: Refining the Risky AnnuityLab Locked
  11. CDS Indices: Intrinsic Spread, RPV01 Weights and the Index SkewLab Locked
  12. Credit Events and Auction Settlement: Payouts, Accrued Premium and Index FactorsLab Locked
  13. CS01: Measuring Spread Risk in a CDS Book and Sizing a HedgeLab Locked
  14. Jump-to-Default: What the Book Loses if a Name Defaults TomorrowLab Locked
  15. CDS Curve Shape: Forward Spreads and Inverted CurvesLab Locked
  16. Carry and Roll-Down of Sold Protection on an Unchanged CurveLab Locked
  17. Pricing a Risky Bond with Survival Probabilities and RecoveryLab Locked
  18. Spread Decomposition: Expected Loss versus Risk PremiumLab Locked
  19. Stress Testing a CDS Book with Rating-Bucket Spread ShocksLab Locked
  20. Final Project: Credit Desk Dashboard for a Fictional CDS BookLab Locked

You are not signed in — the lab works, but your progress is not saved. Sign up

Lesson 1 of 20 is free. Unlock all 20 hands-on labs, the final exam and your certificate.

Buy course — €9.90
Loading the spreadsheet…

Why a corporate bond pays more than a Treasury

Imagine two bonds that both mature in five years. One is a US Treasury, the other is issued by Halvard Industries, a fictional BBB-rated manufacturer. The Treasury yields 4.05%, Halvard yields 5.85%. Both promise fixed coupons and the return of face value, so why would anyone accept the lower yield? Because the Treasury is treated as the market's benchmark for default-free dollars, while Halvard might, in a bad year, fail to pay. The extra 1.80 percentage points is the price the market charges for that possibility. Analysts call it the credit spread, and nearly everything in credit markets, from bond pricing to credit default swaps, is built on top of it.

This free first lesson is for finance students, junior credit and fixed-income analysts, treasury and risk staff, and anyone preparing for a credit or fixed-income exam who wants to see the numbers instead of only reading definitions. You need basic Excel: entering formulas, copying them down and using cell references. In the lab above you work with six fictional bonds. You calculate each spread in basis points, average the BBB names with AVERAGEIF, and then price Halvard's 3-year bond by discounting its cash flows at the Treasury spot curve plus a single constant spread, the Z-spread.

This article walks through the same steps in more depth: what a spread really measures, why the Z-spread is more precise than a simple yield difference, a fully worked example with every formula, two charts, the mistakes that show up in almost every first attempt, and how the idea carries into the rest of the course. All issuers and numbers are fictional and simplified for teaching. This is educational material, not investment or financial advice, and it is not affiliated with ISDA or any dealer.

The core concept: spread is the price of credit risk

A yield spread is simply the bond's yield minus the yield of a Treasury with a similar maturity. Because the differences are small, the market quotes them in basis points (bp). One basis point is one hundredth of a percentage point, 0.01%, or 0.0001 as a decimal. In Excel, where 5.85% is stored as 0.0585, you get basis points by multiplying the decimal difference by 10,000: (0.0585 − 0.0405) × 10,000 = 180 bp.

Why does the spread exist at all? Part of it compensates investors for expected default losses: the chance that the issuer defaults multiplied by how much of the investment is lost if it does. Part of it is a risk premium, because investors dislike losing money in exactly the years when the economy is weak and many issuers default together. And part of it is liquidity: a corporate bond can be harder and more expensive to sell than a Treasury, especially in a crisis. Taxes, the size of the issue and supply and demand in a given week also move spreads. So a spread is not a pure default probability, but it is the market's single best summary of how risky a borrower looks.

The most visible pattern is that spreads widen as credit ratings fall. In the lab, the AA utility trades 57 bp over Treasuries, the single-A food company 84 bp, the two BBB names around 180 to 193 bp, the BB telecom 328 bp and the single-B retailer 497 bp. These are illustrative numbers, but the shape is typical: the step from investment grade (BBB and above) to high yield (BB and below) is usually where spreads jump the most. Spreads also move over time. In calm markets they tighten, in recessions or credit scares they can widen sharply for all ratings at once.

From a simple yield spread to the Z-spread

The simple yield spread has a weakness. A bond's yield to maturity is one single discount rate applied to all of its cash flows, as if interest rates were the same for one year and for ten years. The Treasury yield is also one number for one bond. When the Treasury curve slopes up or down, comparing two such averages can be misleading, especially if the corporate bond's coupon or maturity does not exactly match the benchmark. Analysts sometimes call the spread over an interpolated Treasury yield the G-spread, and the spread over the interpolated swap rate the I-spread.

The Z-spread, short for zero-volatility spread, fixes this by working with the Treasury spot curve (the zero-coupon rates for each maturity). Each cash flow is discounted at its own spot rate plus one constant spread Z. The Z-spread is the value of Z that makes the present value of all cash flows equal to the bond's market price. For annual compounding the discount factor for year t is 1 / (1 + spott + Z)t, and the price is the sum of cash flow × discount factor.

Think of it as lifting the whole Treasury curve by the same number of basis points until the bond is priced correctly. If you try a Z-spread and the model price is above the market price, you have not discounted enough, so the true Z-spread is higher. If the model price is below the market price, the true Z-spread is lower. That inverse relationship between spread and price is the single most useful intuition in credit: when spreads widen, bond prices fall. For bonds with embedded options, such as callable bonds, practitioners go one step further and use an option-adjusted spread (OAS), which removes the value of the option. Halvard's bond in the lab is a plain bullet bond, so the Z-spread is the right tool.

Worked example 1: six bonds and their spreads

The first part of the lab is a small credit screen. Each row holds a bond's rating, maturity, yield and the yield of a Treasury with similar maturity. Column F turns the difference into basis points, and one AVERAGEIF gives the average spread of the BBB group, the kind of number a portfolio manager uses to ask whether one BBB name is cheap or expensive relative to its peers.

BondRatingYearsBond yieldTreasury yieldSpread (bp)Formula in F
Ardent UtilitiesAA54.62%4.05%57=(D2-E2)*10000
Mirelle FoodsA75.02%4.18%84=(D3-E3)*10000
Halvard IndustriesBBB55.85%4.05%180=(D4-E4)*10000
Bayfield ChemicalsBBB106.24%4.31%193=(D5-E5)*10000
Quentor TelecomBB67.40%4.12%328=(D6-E6)*10000
Sorrel RetailB48.95%3.98%497=(D7-E7)*10000
Average BBBBBB186.5=AVERAGEIF(B2:B7,"BBB",F2:F7)

Halvard trades at 180 bp and Bayfield at 193 bp, so the BBB average is (180 + 193) / 2 = 186.5 bp. Halvard is about 6.5 bp tighter than its rating group, Bayfield about 6.5 bp wider. In real life such a small gap is usually explained by maturity (Bayfield's bond runs ten years, Halvard's five, and longer bonds normally carry wider spreads), by sector or by liquidity, so an analyst would compare like with like before calling anything cheap.

Spread over Treasuries by rating (bp)010020030040050057Ardent AA84Mirelle A180Halvard BBB193Bayfield BBB328Quentor BB497Sorrel BBBB average 186.5 bp
Spreads widen as ratings fall. The dashed line marks the BBB average of 186.5 bp computed with AVERAGEIF.

Worked example 2: pricing Halvard's 3-year bond with a Z-spread

The second part of the lab looks at a different Halvard bond: three years left, a 5.00% annual coupon, quoted per 100 of face value at a market price of 98.14. The Treasury spot rates are 3.80% for one year, 4.00% for two years and 4.10% for three years. The trial Z-spread in B17 is 1.60%. For each year you add the spot rate and the Z-spread, compound it, and discount the cash flow.

YearCash flowSpot rateSpot + Z (1.60%)Discount factorPresent value
15.003.80%5.40%0.948767 =1/(1+C13+$B$17)^A134.74
25.004.00%5.60%0.8967524.48
3105.004.10%5.70%0.84678988.91
Price at this Z-spread =SUMPRODUCT(B13:B15,D13:D15)98.14
Market price98.14
Model price minus market price =B18-B19about 0.00

Year 1: 1 / 1.054 = 0.948767. Year 2: 1 / 1.0562 = 0.896752. Year 3: 1 / 1.0573 = 0.846789. Multiply by the cash flows (5, 5 and 105) and add: 4.74 + 4.48 + 88.91 = 98.14. The model price matches the market price almost to the cent, so the difference in B20 is close to zero and the Z-spread of 160 bp is confirmed.

What if the spread had not been given? The table below shows what happens at a few trial values. At zero spread, discounting only at Treasury rates, the bond would be worth 102.52, far above its market price, because the risk of Halvard defaulting has been ignored. Raising Z lowers the price, and somewhere between 1.50% and 1.70% the model meets the market. Excel's Goal Seek finds the exact value in a second, and you will see the steps below.

Trial Z-spreadModel priceVersus market 98.14What it tells you
0.00%102.52+4.38Treasury-only discounting: far too expensive, the credit risk is missing
1.50%98.41+0.27Still too high, so the true Z-spread is larger
1.60%98.14about 0Fits the market price
1.70%97.88−0.26Too low, so the true Z-spread is smaller

It is also worth comparing the Z-spread with the bond's own yield to maturity. =RATE(3,5,-98.14,100) returns about 5.69%, the single rate that discounts all three cash flows to 98.14. The three-year Treasury spot rate is 4.10%, so a quick yield-minus-spot comparison gives roughly 159 bp, very close to the Z-spread here because the curve is fairly flat and the bond is short. With a steeper curve or a longer bond, the two measures drift further apart, which is exactly why desks prefer the Z-spread.

Treasury spot curve + Z-spread (Halvard 3-year bond)3.0%3.5%4.0%4.5%5.0%5.5%6.0%6.5%Year 1Year 2Year 33.8%4.0%4.1%5.4%5.6%5.7%Z = +160 bpTreasury spotSpot + Z-spreadYield to maturity 5.69%
The Z-spread lifts every Treasury spot rate by the same 160 bp. Discounting at the upper curve reproduces the market price of 98.14.

How to do it in Excel, step by step

  1. Enter yields as percentages: select D2:E7 and press Ctrl+Shift+% (or Home > Number > Percent Style) so that 0.0585 shows as 5.85%. Add decimals with Home > Increase Decimal.
  2. In F2 type =(D2-E2)*10000 and press Enter. Select F2:F7 and press Ctrl+D to fill down, or double-click the fill handle at the bottom-right of F2.
  3. Format F2:F7 as a number with zero or one decimal (Ctrl+1 opens Format Cells). Basis points are not percentages, so do not apply the percent format here.
  4. In B9 type =AVERAGEIF(B2:B7,"BBB",F2:F7). The first range is where Excel looks for the rating, the second argument is the criterion, the third range holds the values to average.
  5. In D13 type =1/(1+C13+$B$17)^A13. While the cursor is on B17 in the formula bar, press F4 on Windows (Cmd+T on a Mac) to add the dollar signs, so the Z-spread stays fixed when you copy. Fill down to D15.
  6. In B18 type =SUMPRODUCT(B13:B15,D13:D15). B20 already contains =B18-B19 and should now show almost zero.
  7. To solve for the Z-spread yourself, change B17 to any guess, then go to Data > What-If Analysis > Goal Seek. Set cell: B20, To value: 0, By changing cell: B17. Click OK and Excel iterates until the price matches.
  8. Optional check: in any free cell type =RATE(3,5,-98.14,100) to see the bond's yield to maturity and compare it with the three-year spot rate.
Keep the Z-spread in its own input cell and reference it with an absolute address. Then a single change in B17 reprices the whole bond, and Goal Seek, Data Tables and scenario analysis all work without rewriting formulas.
This lab uses annual compounding and whole-year cash flows to keep the mechanics visible. Real bonds often pay semi-annual coupons, settle between coupon dates (so accrued interest and clean versus dirty prices matter) and use day-count conventions. The logic is the same, only the time steps and compounding change.

Credit spreads and CDS basics course: bond spreads over Treasuries, hazard rates and default probabilities in Excel
The course moves from simple yield spreads to a full CDS pricing model, one Excel lab at a time.

Common mistakes and how to spot them

  • Forgetting the 10,000. A spread of 0.018 is 1.8% or 180 bp. If your spread column shows numbers below 1, you have the decimal, not basis points.
  • Subtracting the wrong way round. A corporate bond should yield more than its Treasury, so a negative spread is a red flag. Spread = bond yield − Treasury yield.
  • Mixing maturities. Comparing a 10-year corporate with a 2-year Treasury mixes the slope of the curve into the spread. Match maturities or interpolate the Treasury yield.
  • Averaging everything. =AVERAGE(F2:F7) gives the average of all six bonds, about 223 bp, not the BBB peer group. Use AVERAGEIF when you want a group.
  • Leaving out the Z-spread. Discounting only at the spot rate gives 102.52, a price above par for a bond trading below par. If your model price is far too high, check that Z is in the formula.
  • Missing the exponent. =1/(1+C15+$B$17) discounts year 3 for one year only. Each cash flow needs the power of its year: ^A15.
  • Relative reference to the spread. Without the dollar signs, copying D13 down moves the reference to B18 and B19, and the discount factors become nonsense. Look for a sudden jump in the factors.
  • Adding cash flows without discounting. =SUM(B13:B15) gives 115, the undiscounted total. A bond price below 115 for a three-year 5% coupon bond is expected.

Quick reference: functions and shortcuts used

Function or shortcutWhat it does hereExample
*10000Turns a decimal yield difference into basis points=(D4-E4)*10000 gives 180
AVERAGEIFAverages only the rows that match a condition=AVERAGEIF(B2:B7,"BBB",F2:F7)
AVERAGEIFSSame with several conditions=AVERAGEIFS(F2:F7,B2:B7,"BBB",C2:C7,"<=5")
^ (power)Compounds the discount rate over t years=1/(1+C15+$B$17)^A15
SUMPRODUCTMultiplies cash flows by discount factors and adds them=SUMPRODUCT(B13:B15,D13:D15)
RATEYield to maturity of an annual-coupon bond=RATE(3,5,-98.14,100) gives about 5.69%
Goal SeekSolves for the Z-spread that matches the priceData > What-If Analysis > Goal Seek
F4 (Windows) / Cmd+T (Mac)Cycles a reference through $B$17, B$17, $B17, B17Lock the Z-spread cell
Ctrl+DFills the formula of the top cell down the selectionSelect F2:F7, press Ctrl+D
Ctrl+Shift+%Formats the selection as a percentageYields in D2:E7

Real-world uses

  • Relative value screening. A credit portfolio manager compares each bond's spread with the average of its rating and sector group to find names that look wide (possibly cheap) or tight (possibly expensive), then investigates why.
  • New issue pricing. When a company issues a new bond, bankers and investors talk in spreads: the deal is marketed at a spread over the Treasury curve and the final coupon follows from where the spread lands.
  • Risk reporting. Risk teams measure how much a portfolio loses if spreads widen by, for example, 50 bp across the board. That starts from exactly the discounting model in this lesson.
  • Corporate treasury. A company's treasurer tracks the spread on its own bonds to judge the cost of new debt and the market's view of its credit before going to market.
  • Link to CDS. The spread on a bond and the premium on a credit default swap on the same issuer usually move together. Comparing them is the CDS-bond basis, lab 8 of this course.

What you will build in the rest of this course

This first lesson is free. Lessons 2 to 20 are part of the paid course, a one-time 9.90 USD, and each one is a hands-on lab with the same Coach that checks your cells.

The Credit Triangle: Spread ≈ PD × LGD. You connect the spreads you just calculated to the two numbers that drive credit losses: the probability of default and the loss given default. You back out the default probability that a given spread implies and see why the recovery assumption matters so much.

Hazard Rates: Survival and Cumulative Default Probabilities with EXP. You turn a constant default intensity into a survival curve with EXP, then into cumulative and year-by-year default probabilities, the building blocks of every CDS model.

The CDS Premium Leg: Quarterly Payments × Survival × Discount. You value the stream of quarterly payments the protection buyer makes, weighting each by the chance that the reference entity is still alive and by the discount factor.

The CDS Protection Leg: Expected Default Payments in Present Value. You value the other side: the payment of the loss if default happens, period by period, in present value.

The Fair CDS Spread: Protection PV / Risky Annuity, and the Upfront. You set the two legs equal to find the fair spread, and convert the difference between that spread and a fixed contract coupon into an upfront payment, the way standardised contracts are quoted.

Mark-to-Market of an Existing CDS When Spreads Move. You revalue a contract after spreads change and see who gains, the buyer or the seller of protection, and by how much.

The CDS-Bond Basis: When CDS and Bond Spreads Disagree. You put the Z-spread from this lesson next to a CDS spread on the same issuer, measure the basis and work through the reasons it can be positive or negative.

Summary

A credit spread is the extra yield a borrower pays over a Treasury, quoted in basis points and driven by default risk, risk premia and liquidity. The simple yield spread is =(bond yield − Treasury yield)*10000. The Z-spread is more precise: one constant spread added to every point of the Treasury spot curve so that the discounted cash flows equal the market price, built in Excel with =1/(1+spot+Z)^t and SUMPRODUCT, and solved with Goal Seek. Higher spread means lower price, and that link runs through every model in credit.

Now scroll back up to the lab and try it yourself: calculate the six spreads, average the BBB names and confirm that 160 bp prices Halvard's bond at 98.14. Then change the Z-spread in B17 to 2.00% and watch the price fall. Once those numbers feel natural, the credit triangle in lesson 2 is the next step.

Frequently asked questions

What is a credit spread?

A credit spread is the extra yield a corporate bond pays over a government bond of similar maturity. It compensates investors for default risk, a risk premium and lower liquidity, and it is usually quoted in basis points.

How do I convert a yield difference to basis points in Excel?

Subtract the two yields and multiply by 10,000, for example =(D2-E2)*10000. A difference of 0.018 becomes 180 basis points.

What is the difference between a yield spread and a Z-spread?

A yield spread compares two single yields. The Z-spread is the constant spread added to every rate of the Treasury spot curve so that the bond's discounted cash flows equal its market price, which handles the shape of the curve more precisely.

How do I calculate a Z-spread in Excel?

Build discount factors with =1/(1+spot+Z)^t for each cash flow, sum the cash flows times factors with SUMPRODUCT, and use Data > What-If Analysis > Goal Seek to change Z until the model price equals the market price.

Why do bond prices fall when credit spreads widen?

A wider spread means a higher discount rate for every cash flow. Higher discount rates make each present value smaller, so the bond's price drops.

Is the Z-spread the same as the option-adjusted spread?

Only for bonds without embedded options. For callable or putable bonds the option-adjusted spread removes the value of the option, so it differs from the Z-spread.

Keep going: Credit Spreads & CDS Basics: Hazard Rates, Spreads & Default Probabilities

This free lab is lesson 1 of 20. Unlock the other 19 hands-on labs, the final exam and your certificate for a one-time €9.90.

  1. The Credit Triangle: Spread ≈ PD × LGD
  2. Hazard Rates: Survival and Cumulative Default Probabilities with EXP
  3. The CDS Premium Leg: Quarterly Payments × Survival × Discount
  4. The CDS Protection Leg: Expected Default Payments in Present Value
  5. The Fair CDS Spread: Protection PV / Risky Annuity, and the Upfront
  6. Mark-to-Market of an Existing CDS When Spreads Move
  7. The CDS-Bond Basis: When CDS and Bond Spreads Disagree
  8. Bootstrapping a Hazard Curve from the CDS Term Structure
  9. Accrued Premium on Default: Refining the Risky Annuity
  10. CDS Indices: Intrinsic Spread, RPV01 Weights and the Index Skew
  11. Credit Events and Auction Settlement: Payouts, Accrued Premium and Index Factors
  12. CS01: Measuring Spread Risk in a CDS Book and Sizing a Hedge
  13. Jump-to-Default: What the Book Loses if a Name Defaults Tomorrow
  14. CDS Curve Shape: Forward Spreads and Inverted Curves
  15. Carry and Roll-Down of Sold Protection on an Unchanged Curve
  16. Pricing a Risky Bond with Survival Probabilities and Recovery
  17. Spread Decomposition: Expected Loss versus Risk Premium
  18. Stress Testing a CDS Book with Rating-Bucket Spread Shocks
  19. Final Project: Credit Desk Dashboard for a Fictional CDS Book

Buy course — €9.90 See the full course