Safety stock formula: how much buffer to hold, with a WooCommerce example
Your best-selling phone case sells four a day and the supplier takes nine days to deliver, so you reorder when 36 are left. Most of the time the delivery arrives just as the last one goes. Then a busy week comes, or the delivery is three days late, and the case is out of stock for days.
Safety stock is the extra stock that covers those surprises. There is no single formula for it: search and you'll find at least four, giving very different answers for the same product. This guide puts them side by side on one worked example, says which suits a small online store, and shows the mistake that quietly breaks all of them: counting the days a product was out of stock.
Everything below works in a spreadsheet. If you'd rather have it done for every SKU, DemandPilot is our tool for WooCommerce inventory forecasting; the last section shows how it handles extra stock.
What safety stock covers, and what it doesn't
Safety stock protects you against two kinds of surprise:
- Demand that varies. Some days you sell 2, some days 8, even though the average is 4.
- Supply that varies. The supplier says nine days; sometimes it's twelve.
It doesn't fix a wrong average. Every formula adds the buffer on top of the average, so if you think a product sells 3 a day and it really sells 4, the buffer goes on covering that error instead of the surprises. Get the average right first (more on that below).
It's also a trade-off, not a right answer: every extra unit costs cash and shelf space, every missing unit costs sales. A formula makes that trade-off the same way for every product.
The four safety stock formulas, side by side
One product, a phone case in a WooCommerce store, with example numbers kept round on purpose:
| Input | Value |
|---|---|
| Average daily sales, on days in stock | 4 units |
| Standard deviation of daily sales | 2 units |
| Busiest day in the last three months | 8 units |
| Supplier lead time, usual | 9 days |
| Supplier lead time, longest | 12 days |
What you expect to sell while you wait for a delivery, the lead-time demand, is 4 × 9 = 36 units. Safety stock is what you hold on top of that.
1. Days of cover
Safety stock = average daily sales × safety days
With three safety days: 4 × 3 = 12 units.
Easy to explain ("we always keep three extra days"), and it grows with sales. But it ignores how erratic a product is: a steady seller and an unpredictable one get the same buffer.
2. Percentage of lead-time demand
Safety stock = percentage × average daily sales × lead time
With 25%: 0.25 × 36 = 9 units.
Just as simple, and it grows with the lead time, which days of cover doesn't: a supplier that takes 30 days gets a bigger buffer than one that takes 5. Still blind to variability.
3. Maximum minus average
Safety stock = (max daily sales × max lead time) − (average daily sales × average lead time)
(8 × 12) − (4 × 9) = 96 − 36 = 60 units.
The worst-case method: it assumes your busiest day repeats on every day of your slowest delivery. That almost never happens, so the result is high: here, 15 extra days of stock.
4. Service level
Safety stock = Z × σ × √L
- Z is a factor for the service level you choose, that is, the share of delivery cycles you want to get through without running out (table below).
- σ (sigma) is the standard deviation of daily sales.
- L is the lead time in days, and √L its square root.
At a 95% service level, Z is 1.65: 1.65 × 2 × √9 = 1.65 × 2 × 3 = 9.9, so 10 units.
This is the textbook formula. It sizes the buffer from how erratic the product is over every day, not just its busiest one, and lets you choose how often you accept running out. It needs daily sales history to work out σ.
| Service level | Z | Safety stock in the example |
|---|---|---|
| 90% | 1.28 | 8 units |
| 95% | 1.65 | 10 units |
| 98% | 2.05 | 13 units |
| 99% | 2.33 | 14 units |
| 99.9% | 3.09 | 19 units |
Going from 95% to 99% adds 40% more safety stock, and 99.9% nearly doubles it: the last points of service are the most expensive, which is why one 99% target for every SKU is usually a mistake.
What 95% means: you get through about 19 delivery cycles in 20 without running out. It doesn't mean 5% of customers leave empty-handed; the share of sales you miss is far smaller, because a stock-out, when it happens, is usually short: the last day or so before the delivery.
When the lead time varies too
The formula above assumes the supplier always takes the same time. If deliveries wobble, use the version that adds lead-time variation (Wikipedia's safety stock article shows where it comes from):
Safety stock = Z × √(L × σ² + d² × σL²)
Here d is average daily sales and σL is the standard deviation of the lead time in days. In the example, with a lead time of 9 days that varies by about 2 days (σL = 2):
1.65 × √(9 × 4 + 16 × 4) = 1.65 × √100 = 1.65 × 10 = 16.5, so 17 units.
Two days of wobble added 7 units: here the supplier's unreliability weighs more than the swings in sales (64 against 36 under the square root), so measuring your real lead times is often the cheapest improvement you can make.
How out-of-stock days distort the inputs
Every formula starts from sales history, which has a blind spot: when a product is out of stock it sells zero, and that zero isn't demand.
Example: in the last 30 days, the case was out of stock for 6. It sold 96 units on the other 24 days, so the true rate is 4 a day.
- Averaged over all 30 days, it looks like 96 ÷ 30 = 3.2 a day: 20% too low.
- The six zeros also make sales look more erratic: the standard deviation comes out at 2.4 instead of 2.
Both inputs are now wrong, in opposite directions. The safety stock rises (1.65 × 2.4 × 3 ≈ 12 instead of 10), so it looks as if you're being more careful. But lead-time demand falls from 36 to about 29, so the stock level at which you reorder drops from 46 units to 41, and you order later. You run out again, which adds more zeros and lowers the average further. The stock-out feeds itself.
The fix: count only the days the product could be bought. Divide units sold by in-stock days, and work out the standard deviation over the same days. Likewise, leave out one-off bulk or test orders, and mark promotions so a sale week doesn't inflate σ.
In a WooCommerce store, the sales are in your orders, but WooCommerce keeps only each product's current stock level, not a day-by-day history, so to know which days a product was out of stock you have to record stock daily or rebuild it from orders and deliveries. The same correction matters for the average itself, which is where the inventory forecasting methods start.
Which formula fits a small shop
- Few products, little history, or just starting out: days of cover or a percentage, set per supplier and reviewed every few months.
- Products that sell most days, with three months or more of history: the service-level formula, with out-of-stock days left out. Give best sellers a higher service level than the long tail, so the cash goes where running out hurts most.
- Suppliers that are often late: add the lead-time term, or at least their typical delay as extra days of cover.
- Slow sellers, a few units a month: the service-level formula assumes demand that follows a bell curve, and a product that sells twice a month doesn't. Keep a fixed minimum instead: "always 2 on the shelf".
- Maximum minus average: only if running out is very costly and cash is cheap.
Whatever you choose, revisit it: a buffer sized in a quiet month is too small for the busy season. And with a few dozen products from two or three suppliers, a spreadsheet with these formulas is enough; a tool earns its place when the catalogue is too big to check by hand every week.
How DemandPilot handles extra stock
DemandPilot reads your WooCommerce catalogue, orders and stock with a read-only REST key. Nothing is installed in WordPress, and it never changes your shop's stock.
- Each night it measures each SKU's rate of sale on in-stock days only, so out-of-stock days don't look like falling demand.
- It forecasts over the supplier's lead time plus the days of stock you want, projects the stock left at the end of that period, and suggests the shortfall, raised to the supplier's minimum order quantity and whole case packs.
- Extra-stock rules come on top, per supplier, brand or SKU, optionally between two dates, for example over the holidays. A rule adds extra days of cover, a percentage, a service level (z × σ × √lead time) or minimum units: the same kinds of buffer as above.
It's priced per shop, by quote.
Frequently asked questions
What is the formula for safety stock?
The most widely used one is Safety stock = Z × σ × √L: the service-level factor, times the standard deviation of daily sales, times the square root of the lead time in days. Simpler alternatives are a fixed number of days of sales, or a percentage of the sales you expect during the lead time.
What is the difference between safety stock and the reorder point?
Safety stock is the buffer. The reorder point is the stock level at which you place a new order: the sales expected during the lead time plus the safety stock. In the example, 36 + 10 = 46 units.
How do I calculate safety stock in a spreadsheet?
List daily sales for the in-stock days in one column. STDEV.S on that column gives σ, NORM.S.INV(0.95) gives Z for a 95% service level, and SQRT of the lead time gives √L. Multiply the three and round up.
How often should I recalculate safety stock?
Monthly is a sensible rhythm for a small shop, plus before every seasonal peak and whenever a supplier's lead time changes.