The Safety Stock Formula: How to Size a Buffer That Actually Prevents Stockouts

Safety stock is the extra inventory you hold to absorb the gap between what you forecast and what actually happens. The safety stock formula turns that idea into a number you can order against instead of a gut feeling. Get it right and you stop running out during demand spikes or slow supplier weeks. Get it wrong the other way and you tie up cash in stock that just sits on a shelf.
This guide gives you the formula, a worked example with real numbers, the version that handles variable lead times, and the mistakes that quietly wreck the math.
The safety stock formula, stated plainly
The most useful version of the safety stock formula accounts for how much demand bounces around during your supplier's lead time:
Safety stock = Z × σ_d × √L
Three inputs, nothing exotic:
- Z is the service factor, a Z-score tied to the service level you want (how often you're willing to be in stock). More on picking this below.
- σ_d is the standard deviation of demand per period (usually per day), a measure of how spiky your sales are.
- L is the lead time, in the same period as your demand (days, if σ_d is per day).
The √L part matters. Variability doesn't add up linearly over the lead time, it grows with the square root of it. A 9-day lead time gives you three times the demand uncertainty of a 1-day lead time, not nine times.
Once you have safety stock, your reorder point falls straight out of it:
Reorder point = (average daily demand × lead time) + safety stock
The first chunk covers expected demand while you wait for the order. Safety stock is the cushion on top for the days that run hot.
A worked example
Say you sell a SKU with these stats, pulled from the last 90 days of sales history:
- Average daily demand: 50 units
- Standard deviation of daily demand: 15 units
- Lead time from your supplier: 9 days (steady, for now)
- Target service level: 95%, which gives Z = 1.65
Plug it in:
Safety stock = 1.65 × 15 × √9
= 1.65 × 15 × 3
= 74.25 ≈ 75 units
So you hold 75 units of buffer. Your reorder point:
Reorder point = (50 × 9) + 75 = 450 + 75 = 525 units
When stock drops to 525, you reorder. On an average run you'll receive the new stock right as you're eating into the last of that 75-unit cushion. On a hot streak, the cushion covers you.
When lead time varies too
Real suppliers aren't metronomes. If your lead time swings between 6 and 13 days, ignoring that variability will leave you short. The version that handles both moving parts is often called King's formula:
Safety stock = Z × √( L × σ_d² + d² × σ_L² )
Two new pieces:
- d is average demand per period (50 units in our example).
- σ_L is the standard deviation of lead time.
Keep the same SKU, but now lead time averages 9 days with a standard deviation of 2 days:
Safety stock = 1.65 × √( 9 × 15² + 50² × 2² )
= 1.65 × √( 9 × 225 + 2500 × 4 )
= 1.65 × √( 2025 + 10000 )
= 1.65 × √12025
= 1.65 × 109.66
≈ 181 units
The buffer jumps from 75 to 181 units. That's not a rounding error. For most operations, unreliable suppliers drive far more safety stock than demand swings do. If your numbers look like this, the cheapest inventory fix is often a conversation with the supplier about consistency, not more stock.
Choosing a service level (and the Z that comes with it)
Service level is the probability you won't stock out during a replenishment cycle. Higher service level means a bigger Z, which means more safety stock. The relationship is not linear, and the top end gets expensive fast.
| Service level | Z (service factor) |
|---|---|
| 90% | 1.28 |
| 95% | 1.65 |
| 97% | 1.88 |
| 98% | 2.05 |
| 99% | 2.33 |
| 99.9% | 3.09 |
Notice the jump from 95% to 99.9%: Z nearly doubles, and so does the stock you carry, to buy back that last sliver of availability. That's why you don't set every SKU to 99%. Reserve the high service levels for your A-items (top revenue, high margin, or products where a stockout loses the customer). Push C-items down to 85-90% and let them run leaner. Segmenting by ABC class is where the formula starts paying for itself.
Calculate it for one SKU, step by step
- Pull 60 to 90 days of daily sales for the SKU.
- Compute average daily demand and the standard deviation of that demand.
- Get the average lead time and, if you have the history, its standard deviation.
- Pick a service level based on the item's importance, then look up Z.
- Use the basic formula if lead time is steady, King's formula if it swings.
- Set the reorder point and, ideally, wire it to fire an alert automatically.
Where the formula quietly breaks down
- Seasonality. A flat 90-day average understates σ_d if you're heading into a peak. Recalculate before known busy periods, or use a same-season window from last year.
- Slow movers and intermittent demand. For a SKU that sells a handful of units a week, the normal-distribution assumption behind Z falls apart. Use a Poisson-based or min-max approach instead.
- Stale inputs. Lead times drift, suppliers change, demand shifts. Safety stock set once and forgotten is worse than useless because it feels precise. Recompute quarterly at minimum.
- Averaging across locations. Demand variability at one warehouse is not the sum of variability across five. Calculate per location, per SKU, or you'll overstock the network.
Doing this without a spreadsheet graveyard
The math is simple. Keeping it current across hundreds of SKUs and multiple locations is the hard part, and that's usually where the spreadsheet approach quits. Inventoros calculates reorder points and multi-location stock buffers out of the box, and because it's free, open source, and self-hosted, your sales history and cost data never leave your own server. You can see the stock and alerting features, read the full setup in the documentation, or pull demand and lead-time data programmatically through the REST and GraphQL API to feed your own safety stock model. Own the data, own the math.
FAQ
What is the safety stock formula?
The standard safety stock formula is Safety stock = Z × σ_d × √L, where Z is the service factor for your chosen service level, σ_d is the standard deviation of demand per period, and L is the lead time. It sizes the buffer you hold to cover demand variability while you wait for a replenishment order to arrive. When lead time also varies, use King's formula, which adds a term for lead-time standard deviation.
How do I choose the right service level?
Match it to the item's value and the cost of a stockout. High-revenue or high-margin A-items justify 97-99%, where a lost sale hurts. Low-value, easily substituted C-items can sit at 85-90% to free up cash. Chasing 99.9% across the board roughly doubles your carrying cost versus 95% for very little real-world gain.
Is safety stock the same as the reorder point?
No. Safety stock is only the buffer for the unexpected. The reorder point is the expected demand during lead time plus that buffer: (average daily demand × lead time) + safety stock. You hold safety stock; you act on the reorder point when on-hand stock hits it.
How often should I recalculate safety stock?
Quarterly is a sensible baseline, plus a refresh ahead of any known seasonal peak or after a supplier's lead time changes. If demand or lead-time variability shifts and your inputs are stale, the formula will still hand you a confident number, it'll just be the wrong one.