How to calculate a Z-spread
Quick answer
To calculate a Z-spread, bootstrap the Treasury par curve into spot rates, then find the single constant spread that, added to every spot rate, discounts the bond's cash flows back to its market price. There is no closed form, so you solve for it numerically. State the compounding convention next to the number, because on the same bond and the same curve it can move the answer by several basis points, and make sure the bond price and the curve come from the same date before you chart it over time.
A Z-spread is the one constant spread that, added to every point on the Treasury spot curve, makes the discounted value of a bond's cash flows equal its market price. You calculate it by bootstrapping spot rates from the Treasury curve and then solving for the spread numerically, because there is no formula you can rearrange.
The arithmetic is the easy part. The harder part is that the number depends on choices the textbook examples never mention, and when you put a Z-spread on a chart over time those choices can move the line more than the credit does.
What the Z-spread measures
A plain yield spread (the G-spread) compares one number with one number: the bond's yield to maturity against the Treasury yield at the same maturity. That treats every cash flow as if it were discounted at a single rate. The Z-spread discounts each cash flow at its own spot rate, so a coupon due in six months is discounted at the six-month Treasury spot rate plus the spread, and the final principal at the five-year spot rate plus the same spread.
The "zero" in the name means zero volatility: the calculation assumes the cash flows are fixed. For a bond with a call or put option that assumption is wrong, and the Z-spread overstates the credit risk. That is the job of the option-adjusted spread, which is a different calculation built on a rate tree or simulation.
How to calculate a Z-spread, step by step
- Get the Treasury par yield curve for the pricing date. Treasury.gov publishes it daily as a free CSV. The yield curve post covers where it lives and what each column means.
- Bootstrap spot rates from the par yields. Treat each par yield as a bond priced at 100 paying half its yield every six months, and solve for the discount factor at each maturity using the factors you already have. Par yields between the published tenors need interpolating. Linear is fine for teaching; Treasury's own curve uses a monotone convex method, so expect small differences if you compare against published spot rates.
- List the bond's cash flows and their times in years: each coupon, and the principal at maturity.
- Write the price as a function of the spread: the sum of each cash flow discounted at its spot rate plus the spread.
- Solve for the spread that makes that function equal the market price. Bisection or Brent's method both converge quickly because price falls steadily as the spread rises.
In Python, with math and scipy imported, the solve step is a few lines. With spot(t) returning the spot rate at time t as a decimal, cfs a list of (t, amount) pairs and price the market price:
def pv(z): return sum(a * math.exp(-(spot(t) + z) * t) for t, a in cfs)
z = scipy.optimize.brentq(lambda z: pv(z) - price, -0.05, 0.50)
That version uses continuous compounding. Hold on to that detail, because it is the first thing that moves the answer.
A worked example on the 22 September 2026 curve
The curve is real: the Treasury par yield curve published for 22 September 2026, which reads 4.26% at six months, 4.43% at one year, 4.71% at two years, 4.81% at three years and 4.83% at five years. Bootstrapped with linear interpolation of the par yields, the five-year spot rate comes out at 4.838% on a semiannual basis.
The bond is hypothetical and exists to make the arithmetic visible: a five-year bond paying a 5.50% coupon semiannually, priced at 97.25, settling on a coupon date so there is no accrued interest to worry about. Discounted at Treasury spot rates alone it would be worth 102.95. The market says 97.25, so the spread has to explain a gap of about 5.7 points of price.
Solving gives these numbers, all from the same curve and the same price:
- Yield to maturity: 6.147%.
- G-spread (yield minus the 4.83% five-year par yield): 131.7 basis points.
- Z-spread, semiannual compounding: 131.9 basis points.
- Z-spread, continuous compounding: 128.3 basis points.
Two things stand out. On a curve this flat between three and five years, the Z-spread and the G-spread are almost identical, 0.2 basis points apart. The Z-spread earns its keep when the curve is steep. On the much steeper 2 January 2026 curve, the same comparison for a ten-year version of this bond puts the Z-spread 2.2 basis points above the G-spread.
The bigger gap is the other one. Changing nothing but the compounding convention moves the Z-spread by 3.6 basis points, which is more than the difference between a Z-spread and a G-spread on this curve. Neither number is wrong. They are answers to slightly different questions, and a chart that compares your Z-spread with one from a data vendor is only honest if both used the same convention. Write it on the axis label.
Charting a Z-spread over time without fooling yourself
The chart most people want is one line: this bond's Z-spread, every day, for a year. It is worth building, and it is easy to build a version that reports the Treasury market instead of the bond.
Price and curve must share a timestamp
A Z-spread is a price read against a curve. If the price is stale, the spread still moves every day, because the curve does.
Here is the same hypothetical bond, still priced at 97.25, measured against the Treasury curve of 2 January 2026 instead of 22 September. The Z-spread is 241.4 basis points on the semiannual basis. Nothing about the bond changed. Treasuries sold off between January and September, the spot curve rose, and a price that never updated now looks like a bond that tightened by more than 100 basis points.
This is the everyday failure on corporate bonds that trade rarely. The last traded or evaluated price may be days old while the Treasury curve is today's. Before you trust a move on the chart, check that the price actually printed on that date. Where it did not, mark the point as carried forward or leave a gap. A flat price series next to a moving spread line is the signature of this problem.
Keep the curve method fixed across the whole series
If the interpolation method or the source of the curve changes halfway through the series, the line gets a step that no investor caused. Pick the curve, the interpolation and the compounding convention once, and record all three in the chart's notes.
Pair it with the index view, not instead of it
A single bond's Z-spread answers "is this bond cheap against Treasuries today?" The market-wide question, "is credit risk rising?", is better answered by the index option-adjusted spreads covered in how to chart credit spreads over time. Put the two lines together and the chart starts to argue something: a bond whose spread widens while the index is flat is telling you about the issuer, not about the cycle.
How the Z-spread relates to duration
A Z-spread is quoted in basis points, and the price effect of a basis point depends on the bond's duration. A 20 basis point widening on a two-year bond and on a ten-year bond are very different losses. If you are charting a spread move to explain a price move, the duration and convexity post covers how to turn one into the other properly, including why the straight-line approximation understates price for large moves.
When the curve shape itself is the story, how to visualize a yield curve inversion covers the view that sits underneath all of this.
[QUADESTO-EMBED: Treasury spot curve for 22 Sep 2026 with the same curve shifted up by the solved Z-spread, the bond's discounted cash flows marked on the shifted curve, and a toggle between semiannual and continuous compounding showing the spread change]
Where Quadesto fits
Quadesto turns your own rates and bond data into branded finance charts like this one, shared as a link, embedded as an iframe, or exported as an image. Whatever tool you use, put the curve, the interpolation and the compounding convention in the chart's notes. That is exactly the information a reader needs to compare your spread with anyone else's.