What Is Safety Stock?
Safety stock is extra inventory held to reduce the risk of running out while waiting for a supplier order. It protects against two uncertainties: selling more than expected and receiving a replenishment order later than expected.
For a Shopify store, too little safety stock can mean missed sales and customers turning to competitors; too much ties up cash in inventory that could fund other operations. The right amount depends on your sales and supplier data, your target service level, and the cost of each risk.
Safety Stock Formulas
The combined variability method accounts for uncertainty in both daily demand and supplier lead time:
σ_dLT = √(LT × σ_d² + d̄² × σ_LT²)
Safety Stock = Z × σ_dLT
Where:
- d̄ = average daily sales in units
- σ_d = standard deviation of daily sales
- LT = average supplier lead time in days
- σ_LT = standard deviation of lead time in days
- Z = z-score for the chosen service level
- σ_dLT = standard deviation of demand during lead time
An approximate annual holding cost is:
Annual Holding Cost = Safety Stock × Unit Cost × Annual Holding Cost Rate
The combined formula assumes demand and lead time vary independently. If your supplier lead times change in response to demand spikes, or sales are strongly seasonal, use data from comparable periods and revisit the estimate as conditions change.
How to Use This Calculator
- Enter
avgDailySales— average units sold per day, using a period that reflects current demand. - Enter
stdDevDailySales— how much daily sales typically vary. Use historical daily data if available; otherwise estimate it from the peak and average day. - Enter
avgLeadTimeandstdDevLeadTime— average order-to-delivery days and the usual variation around that average. Supplier delivery records are more reliable than estimates. - Enter
unitCostandsellingPrice— your cost and customer price per unit. These values help estimate inventory value and stockout impact. - Enter
holdingCostPct— annual carrying costs as a percentage of unit cost, including storage, insurance, and the cost of cash tied up in stock. - Enter
grossMargin— the share of sales revenue left after product costs, used to estimate lost profit from stockouts. - Compare the service levels — review how the required stock changes across the available levels, and check whether demand or lead time variability contributes more.
The U.S. Small Business Administration recommends tracking financial performance and cash flow; inventory belongs in that view because it uses working capital. SBA guidance on managing business finances can help you assess that tradeoff alongside your stock estimate.
Step-by-Step Example
A Shopify store sells reusable water bottles and wants a 95% service level. Assume average sales of 20 units per day, daily sales standard deviation of 4 units, average lead time of 10 days, and lead time standard deviation of 2 days.
| Calculation | Math | Result |
|---|---|---|
| Demand variability term | 10 × 4² = 10 × 16 | 160 |
| Lead time variability term | 20² × 2² = 400 × 4 | 1,600 |
| Combined standard deviation | √(160 + 1,600) = √1,760 | 41.95 units |
| Safety stock | 1.645 × 41.95 | 69.0 units |
| Inventory value | 69 × $8 unit cost | $552 |
| Annual holding cost | $552 × 24% | $132.48 |
The store would hold about 69 extra bottles under these assumptions. If the unit sells for $45 at a 55% gross margin, one day of average sales represents 20 × $45 × 0.55 = $495 in gross profit at risk during a stockout; this is an estimate, not a guarantee of lost sales.
Choosing a Service Level
A service level is the probability of avoiding a stockout during a replenishment cycle. A 95% cycle service level does not mean that 95% of all units demanded will be supplied; that measure is called the fill rate. This distinction matters when comparing inventory targets with sales performance.
Higher service levels require more buffer stock, and the extra units can grow quickly because the calculation multiplies the combined standard deviation by a larger z-score. Compare the added annual holding cost with the likely profit and customer impact of a stockout rather than choosing the highest level for every product. Use a higher target for products customers are likely to abandon your store over, and a lower target for items with weak demand or short selling seasons.
The Census Bureau tracks retail inventories and sales, including the inventory-to-sales ratio, as a measure of how inventory relates to sales across retail. Its retail trade data provides useful context for monitoring inventory, but it is not a substitute for a product-level safety stock target.
Planning Benchmarks by Demand Profile
These are starting ranges for discussion, not universal industry standards. Use your own sales and supplier history to set the final assumptions.
| Product profile | Typical demand CoV* | Starting service-level range |
|---|---|---|
| Stable, predictable repeat purchase | 15–25% | 95–99% |
| Moderate variation or regular promotions | 25–50% | 90–95% |
| Volatile, trend-driven, or seasonal | 50%+ | 85–95% |
*Coefficient of variation (CoV) = daily sales standard deviation ÷ average daily sales. The table’s ranges are planning guides: margins, replenishment options, and customer behavior can justify a different target.
Use the Reorder Point Calculator to combine safety stock with expected demand during lead time and estimate when to reorder. To balance order size against storage and ordering costs, compare your purchase quantity with the Economic Order Quantity (EOQ) Calculator.
6 Tips to Set Better Safety Stock
- Use at least 8–12 weeks of daily sales data for stable products, then separate out promotions and unusual spikes before calculating standard deviation.
- Change the service level from 95% to 99% for a high-margin best-seller and compare the extra holding cost with the profit exposed to a stockout.
- Change
stdDevLeadTimefrom 4 days to 1 day in a trial calculation. If required stock drops substantially, focus on supplier reliability or a backup source. - Recalculate after a promotion rather than treating the temporary sales surge as normal demand; tag campaign dates in Shopify reports so you can identify the lift.
- Review safety stock monthly for fast-moving products and at each season change for seasonal products. Old demand and supplier data can make a precise calculation misleading.
- Compare carrying cost with stockout impact before increasing every SKU’s buffer. The Stockout Cost Calculator can help estimate lost sales, customer churn, and other stockout costs.
Frequently Asked Questions
How do you calculate safety stock?
Safety stock = Z × σ_dLT, where Z is the service level z-score (1.65 for 95%) and σ_dLT is the combined standard deviation of demand during lead time. The combined formula is σ_dLT = √(LT × σ_d² + d̄² × σ_LT²), accounting for both demand and lead time variability.
What is a good service level for safety stock?
A 95% service level is a common starting point, while best-sellers or products with costly stockouts may warrant a higher target and slow-moving or seasonal items may suit a lower one. Raising the target increases inventory and carrying costs, so compare that expense with the profit and customer impact at risk.
What is the difference between demand variability and lead time variability?
Demand variability measures changes in daily sales—for example, selling 8 units on some days and 22 on others—while lead time variability measures changes in supplier delivery time. Demand spikes use stock faster; late deliveries extend the period your inventory must cover, so the calculator shows which source contributes more to the buffer.
How do I estimate standard deviation of demand?
Use daily sales history and a spreadsheet’s STDEV function when possible; a rough estimate is (peak daily sales − average daily sales) ÷ 2. If using a coefficient of variation instead, multiply average daily sales by the CoV: stable products may fall around 15–25%, moderate ones around 25–50%, and volatile products above 50%.
Is safety stock worth the holding cost?
It depends on the carrying cost and the likely consequences of a stockout, including lost profit and customers who may not return. Compare the annual cost of holding the extra units with the stockout exposure for that specific product; a high buffer can be poor value for an item with weak demand or easy substitutes.
About This Calculator
Luis Dev Studio built this safety stock calculator for Shopify merchants comparing service levels, demand and lead time variability, and inventory costs. For help applying the results to your store, contact us.
Updated by Luis Gonzalez · Apr 23, 2026