How to Calculate Safety Stock for Your Shopify Store
Safety stock is the single most important number in inventory planning, and most Shopify apps either skip it or oversimplify it. Here is the actual formula, why it matters, and how to set it for every SKU in your store.
The number that separates guessing from planning
If you manage inventory for a Shopify store, you have probably experienced this: you check your stock levels, everything looks fine, and then two weeks later your best seller is out of stock and you are watching add-to-cart clicks evaporate. Or the opposite: you over-ordered on a hunch and now you have six months of a slow mover tying up cash in your warehouse.
Both problems have the same root cause. You are making reorder decisions without a buffer that accounts for the fact that demand is not constant and suppliers do not always deliver on time.
That buffer is called safety stock. It is the single most important number in inventory planning, and most of the tools marketed to Shopify merchants either skip it entirely or reduce it to a static number you set manually.
What safety stock actually is
Safety stock is extra inventory you keep on hand specifically to protect against two types of uncertainty:
- Demand variability. Your customers do not buy the same quantity every day. Some days you sell 12 units, some days you sell 3. The wider that range, the more buffer you need.
- Supply variability. Your supplier says lead time is 14 days, but sometimes it is 12 and sometimes it is 18. That inconsistency creates risk.
Safety stock is not a guess. It is not "keep an extra 20% on hand." It is a statistically derived number based on how much your demand fluctuates, how much your lead time fluctuates, and how aggressive you want to be about avoiding stockouts.
The formula
The textbook-correct safety stock formula that accounts for both demand AND supply variability is:
SS = Z x sqrt( (LT x SD_d^2) + (AD^2 x SD_lt^2) )
Where:
- SS = Safety Stock (units)
- Z = Z-score for your desired service level (more on this below)
- LT = Average Lead Time (days)
- SD_d = Standard Deviation of daily demand
- AD = Average Daily Demand
- SD_lt = Standard Deviation of lead time (days)
- sqrt = square root
This is sometimes called the "combined variability" formula because it accounts for uncertainty on both the demand side and the supply side simultaneously. Most simplified versions you will find online drop the lead time variability term entirely, which underestimates the buffer you actually need.
Breaking it down, piece by piece
Z-score (service level)
The Z-score translates your desired service level into a statistical multiplier. Common values:
| Service Level | Z-Score | What It Means |
|---|---|---|
| 90% | 1.28 | You accept stockouts roughly 10% of the time |
| 95% | 1.65 | The most common target for general merchandise |
| 97.5% | 1.96 | Higher protection, more inventory investment |
| 99% | 2.33 | Near-zero tolerance for stockouts, significant buffer |
For most Shopify stores, 95% is the right starting point. You can set it higher for your top sellers and lower for slow movers. The key insight is that going from 95% to 99% does not sound like a big jump, but it nearly doubles your safety stock. That is real cash tied up in inventory.
Average Daily Demand (AD)
This is straightforward: total units sold over a period, divided by the number of days. If you sold 270 units of a SKU over the last 90 days, your average daily demand is 3 units per day.
Use at least 60 to 90 days of history to smooth out short-term noise. If you have strong seasonality, use the same period from last year instead.
Standard Deviation of Demand (SD_d)
This measures how much your daily sales bounce around. If you sell exactly 3 units every single day, your standard deviation is 0 and you need very little safety stock. If you sell 0 one day and 15 the next, your standard deviation is high and you need a bigger buffer.
In a spreadsheet, this is just the STDEV function applied to your daily sales figures.
Average Lead Time (LT)
How many days, on average, between placing a PO and receiving the goods. If your supplier typically delivers in 14 days, LT = 14.
Standard Deviation of Lead Time (SD_lt)
How much your lead time varies. If your supplier delivers in 12 to 18 days with an average of 14, the standard deviation captures that spread. If you do not have historical data on lead time variability, a reasonable starting estimate is 20% of your average lead time (so if LT = 14, start with SD_lt = 2.8 days).
A worked example
Let's say you sell a product with these characteristics:
- Average daily demand: 5 units/day
- Standard deviation of daily demand: 2.1 units
- Average lead time: 21 days
- Standard deviation of lead time: 3 days
- Target service level: 95% (Z = 1.65)
Plugging into the formula:
SS = 1.65 x sqrt( (21 x 2.1^2) + (5^2 x 3^2) )
SS = 1.65 x sqrt( (21 x 4.41) + (25 x 9) )
SS = 1.65 x sqrt( 92.61 + 225 )
SS = 1.65 x sqrt( 317.61 )
SS = 1.65 x 17.82
SS = 29.4 units, round up to 30
You should keep 30 units of safety stock for this SKU. That means when your inventory hits your reorder point (which is calculated using this safety stock number plus your expected demand during lead time), you place a new order.
Notice that the lead time variability term (225) is actually larger than the demand variability term (92.61) in this example. If you had used the simplified formula that ignores lead time variability, you would have calculated a safety stock of only 16 units. That is nearly half the buffer you actually need.
Why most Shopify apps get this wrong
Most inventory apps marketed to Shopify merchants do one of three things with safety stock:
- Skip it entirely. They calculate average demand, multiply by lead time, and call that your reorder point. No buffer at all.
- Use a flat percentage. "Keep 20% extra." This ignores the fact that a SKU with stable demand needs far less buffer than one with erratic sales, even if they have the same average.
- Use the simplified formula. They calculate safety stock based on demand variability only, ignoring lead time variability. Better than nothing, but systematically underestimates the buffer for products with unreliable suppliers.
Stocky, for reference, did none of the above. It had no safety stock calculation at all. Its "forecasting" was a simple average projected forward.
How to set this up in a spreadsheet
If you are building this yourself, here is what you need:
- Export your Shopify order history (90 days minimum). Calculate daily unit sales per SKU.
- Calculate average daily demand for each SKU. This is the AVERAGE function on your daily sales column.
- Calculate standard deviation of daily demand for each SKU. This is the STDEV function on the same column.
- Enter your lead time per SKU (or per supplier, then map to SKUs). If you do not track lead time variability yet, use 20% of your average lead time as an estimate and refine over time.
- Choose your service level. Start with 95% (Z = 1.65) for most SKUs. Consider 99% for your top 5 sellers and 90% for slow movers.
- Apply the formula. One cell per SKU. The result is your safety stock in units.
- Calculate your reorder point: ROP = (Average Daily Demand x Average Lead Time) + Safety Stock.
That reorder point is the inventory level at which you should place a new order. When your on-hand quantity drops to that number, it is time to reorder.
The payoff
Once you have safety stock and reorder points calculated for every SKU, your weekly inventory review becomes mechanical:
- Open your spreadsheet
- Update your current inventory levels
- Look at which SKUs are at or below their reorder point
- Place orders for those SKUs
No guessing. No gut feel. No "I think we are running low on that one." The math tells you exactly what to order and when.
The entire weekly process takes 5 to 10 minutes once the model is set up. The setup itself takes about 30 minutes if your spreadsheet is already structured for it.
Ready to build your reorder plan?
SkuClerk is a plug-and-play spreadsheet that does everything described above — safety stock, reorder points, EOQ, and three forecast modes — for $79, one time.
Get SkuClerk — $79