Guide7 min read

Safety Stock Formula for Shopify Merchants: Never Run Out Again

Safety stock is the buffer inventory that protects you from stockouts during demand spikes and supplier delays. Here's the formula and how to calculate it for your Shopify products.

Last updated: April 2026

Researched by the ShelfMerge Research Team

Stockouts cost more than you think. A customer who hits an out-of-stock page doesn't wait — they buy from someone else, often your direct competitor. If you have a subscription customer, a stockout can break their renewal. If you're running ads to a product, a stockout means you're paying to send traffic to a dead end.

Safety stock is the buffer inventory you hold above your expected demand to absorb surprises. Demand spikes. Supplier delays. Shipping delays at the border. Safety stock buys you time when any of those hit.

When you actually need safety stock

Not every product needs a large buffer. Safety stock is most critical when:

  • Demand fluctuates significantly week to week
  • Your supplier has variable lead times
  • Stockouts have a high cost (subscription products, hero SKUs)
  • Reorder lead time is long (overseas manufacturing, sea freight)
  • The product is running an active ad campaign

A slow-moving product with a local supplier and a 3-day lead time doesn't need much safety stock. A fast-moving product with a 45-day lead time from overseas and irregular demand needs a real buffer.

The basic safety stock formula

Safety Stock = Z × σ(lead time demand)

Where Z is your desired service level factor and σ is the standard deviation of demand during the lead time period.

That's statistically precise but requires variability data most merchants don't have readily available. Here's the practical version most operators use:

Safety Stock = (Maximum Daily Sales − Average Daily Sales) × Maximum Lead Time

This formula captures the worst-case scenario: your highest-demand day happens during your longest supplier delay. The gap between max and average daily sales is your demand risk. Maximum lead time is your supply risk. Multiply them and you get the buffer needed to survive the worst realistic combination.

A worked example

You sell a popular face wash. Here's what you know:

InputValue
Average daily sales12 units/day
Maximum daily sales (peak)28 units/day
Average lead time18 days
Maximum lead time28 days

Safety Stock = (28 − 12) × 28 = 16 × 28 = 448 units

That's how many extra units you need on hand beyond your normal reorder point to absorb a demand spike that happens at the same time as your supplier takes 10 extra days to deliver.

Reorder point: where safety stock fits in

Safety stock doesn't exist in isolation. It's part of your reorder point calculation:

Reorder Point = (Average Daily Sales × Average Lead Time) + Safety Stock

Using the same example: (12 × 18) + 448 = 216 + 448 = 664 units

When your stock drops to 664 units, place a new order. That gives you enough inventory to cover average demand during your average lead time (216 units), plus your safety buffer (448 units) in case things go sideways.

Service level: how much buffer is enough?

The statistical formula uses a service level percentage, which determines the Z factor. Higher service level means more buffer means more capital tied up.

Service LevelZ FactorMeaning
90%1.28In-stock 90% of the time during lead time
95%1.65In-stock 95% of the time during lead time
99%2.33In-stock 99% of the time during lead time
99.9%3.09Near-zero stockout risk, highest buffer cost

Most ecommerce merchants target 95% service level on their top SKUs. That covers the vast majority of demand spikes without requiring enormous safety buffers. Reserve 99%+ for subscription products or items where a stockout has a direct revenue contract impact.

Getting your inputs right in Shopify

The formula is only as good as the numbers you put in. Here's how to get them from Shopify:

Average daily sales: Go to Analytics > Reports > Product reports. Filter to the last 90 days. Take total units sold, divide by 90. That's your daily average.

Maximum daily sales: Pull the same 90-day order export and sort by day. Find the highest single-day order count. If you had a flash sale or PR spike in that period, decide whether to include it — if that kind of spike is repeatable (scheduled promotions), include it. If it was a one-time event, use the highest normal day instead.

Lead times: Check your purchase order history. Average the actual number of days between placing an order and receiving inventory. Maximum lead time is your worst delay in recent history. If you've never tracked this, ask your supplier for their stated lead time and add 30% as your maximum.

Updating safety stock when things change

Safety stock isn't a one-time calculation. It needs to update when:

  • You enter a new season with different demand patterns
  • You switch suppliers or shipping routes
  • You launch a marketing campaign that increases velocity
  • Your supplier starts hitting delivery delays regularly
  • You add a new sales channel that adds demand volume

Most merchants calculate safety stock once and forget about it. Demand and supply both shift. A product that needed 200 units of safety stock last year might need 400 this year if you're running paid ads to it now.

Safety stock vs. cycle stock

These two are different. Cycle stock is the inventory you burn through between orders — it's your expected demand during lead time. Safety stock is the extra buffer on top of that.

Your total minimum inventory at the reorder point = cycle stock + safety stock. Your reorder quantity covers the cycle stock for the next order cycle. Safety stock is always there, never depleted under normal conditions.

Using ShelfMerge's safety stock calculator

ShelfMerge's safety stock calculator pulls your daily sales history directly from Shopify and calculates average and maximum daily sales automatically. You enter your lead time data (which you know from your supplier) and the calculator outputs recommended safety stock quantities per product.

For products in your catalog with active inventory, it also shows your current days of cover — how many days of average demand your current stock can satisfy — alongside the safety stock recommendation. If your days of cover drops below your lead time plus safety buffer, you'll see a reorder alert before you run out.

The goal is to stop doing this in spreadsheets after every big sale or every supplier delay. Get the calculation running automatically so stockouts become a known risk you've accounted for, not a surprise that costs you a week of sales.

Frequently asked questions

What is the safety stock formula?

The practical formula is: Safety Stock = (Maximum Daily Sales − Average Daily Sales) × Maximum Lead Time. This covers the worst-case scenario where demand peaks at the same time your supplier takes longer than usual to deliver. The statistical version uses a Z-factor based on your target service level and the standard deviation of lead time demand.

How do I find maximum daily sales in Shopify?

Export your order history for the last 90 days from Shopify Analytics. Group orders by day and find the highest single-day unit count for the product. If that day was a one-time event (like a viral post), use your highest normal day instead.

What service level should I target for safety stock?

Most ecommerce merchants target 95% service level on their top SKUs — meaning they want to be in stock 95% of the time during the lead time period. The Z-factor for 95% is 1.65. Reserve 99%+ for subscription products where a stockout breaks a recurring revenue relationship.

How often should I recalculate safety stock?

Recalculate whenever something significant changes: new season, new ad campaign, supplier switch, or new sales channel. At minimum, review your safety stock quantities quarterly. A product that needed 200 units of buffer last year might need 400 this year if you've scaled ad spend to it.

Try ShelfMerge free

Connect your Shopify store and get a full catalog health report in under 60 seconds. Dead inventory, variant analysis, cannibalization detection — all automated.

Free plan available. No credit card required.