Inventory

Safety Stock Calculation for Shopify: Formula, Service Level, and Example

How much safety stock should you hold?

A safety stock calculation tells you how many extra units to hold so a late receipt or a high-demand week does not wipe out the units you already expected to sell during lead time. The result is a buffer. Order quantity and reorder timing are separate decisions, and this page does not calculate either one.

This page owns the buffer math only: which Shopify fields are inputs, which service level to use, and which formula fits when lead time moves. The reorder timing guide already covers when to place the order, including a basic buffer with no service factor. Use that guide for timing only. Do not treat it as this safety stock calculation, and do not copy its shortcut back onto this page.

You need four inputs, all in one time unit: average demand, how far demand swings from that average, average lead time, and how far receipts miss the promised date. Then you choose a service level. Steady demand and steady receipts can live with a smaller buffer. A supplier who often misses the date can still stock out a bestseller when average demand during lead time looks covered.

Where to read stock, and where not to

Shopify's inventory reports are not the Inventory page. Those reports display a month-end snapshot and help you track the quantity and percentage of inventory sold per day. None of the columns on those reports is a safety stock figure.

On the month-end inventory snapshot, ending quantity is trackable Available inventory. Shopify states that Available on that report excludes committed units for orders pending fulfillment and incoming units that are part of a transfer. Do not read that ending quantity as stock already on the way.

A month-end snapshot ending quantity is Available stock. It leaves out incoming transfer units, so it is the wrong number to treat as units already inbound.

Incoming quantity lives on the inventory-management view. Shopify's inventory states documentation says the states appear on the Inventory page next to each product or variant, and on the inventory card of the product or variant page. Incoming is inventory on the way from transfers, purchase orders, or apps. Available does not include Incoming. On hand is only Committed, Unavailable, and Available, so it excludes Incoming until you receive it and the state changes.

Use Incoming to see what is already ordered. Use Available or On hand to see what you can already count at the location. Keep those figures out of the safety stock formula itself. The formula estimates extra units for risk. Adding inbound units into the buffer double-counts supply that is supposed to cover average demand, not the surprise.

Shopify also uses the words safety stock for a different job. Unavailable inventory can include units an app or a manual adjustment has set aside as safety stock, along with damaged or quality-control units. Those units are on hand and not sellable. That setting is not this calculation. If you both park units as Unavailable and order a statistical buffer on top, you can hold the same protection twice.

Gather demand and lead time in one time unit

Open Analytics, then Reports, filter Category to Inventory, and start with Inventory sold daily by product. Shopify defines quantity sold as units sold in the selected period, and quantity sold per day as that quantity divided by the days in the period. Quantity sold does not reflect returns, manual adjustments, or transfer receipts. Treat it as units sold, not as net demand after refunds.

Inventory-based metrics in these reports go back only to October 1, 2023. A longer history than that is not in the inventory reports. If you need older weeks, use order history outside that report window.

The Inventory remaining per product report estimates days left from ending quantity divided by average units sold per day, and that average uses the last 28 days. A flat 28-day average hides the week-to-week swing the buffer is meant to cover. Use it as a stock-cover check, not as the variability input.

  1. Pick one period length and stay with it. Weekly demand needs lead time in weeks. Daily demand needs lead time in days. Mixing the two inflates or shrinks the buffer.
  2. Build a short series of demand for that variant, at least eight periods if you can. Average them. Then take the sample standard deviation with STDEV.S in a spreadsheet, which divides by the number of periods minus one.
  3. List actual receipt dates from purchase orders or transfers against the date you placed each order. Average those lead times. If receipts cluster on the promised day, lead-time variability is near zero. If they do not, calculate STDEV.S on the lead times too.
  4. Do not pull lead time from the month-end snapshot. That report has no supplier lead-time field.

Choose a service level before you multiply

A service level here means the share of replenishment cycles you are willing to cover without a stockout. That is a cycle service level, not the share of units filled. It is a choice about missed sales versus extra units held, not a setting in Shopify.

Use Shopify's ABC product analysis on the same inventory reports page to decide who gets the higher target. Over the last 28 days, A-grade variants collectively account for 80% of revenue, B-grade the next 15%, and C-grade the last 5%. The timeframe cannot be adjusted. Give A-grade variants a higher cycle service level than C-grade variants. One factor for the whole catalog overstocks slow movers and under-protects the products that carry revenue.

For a deeper cut on which variants deserve the tighter buffer, pair that grade with an ABC analysis for Shopify inventory. The grade tells you priority. It does not replace the demand series above, because 28 days of revenue share is not a standard deviation.

Z, the service factor in the formulas below, is the one-sided quantile of the standard normal distribution for the cycle service level you pick. Compute it with NORM.S.INV in a spreadsheet rather than treating it as a published benchmark. NORM.S.INV(0.95) is about 1.64485, and the worked example rounds that to 1.65. The same standard normal calculation gives about 1.28 at 90% and about 2.33 at 99%. Those factors apply only if demand during lead time is roughly bell-shaped. They are not a field on the inventory reports above. A higher Z holds more units. Raise it when a stockout on that variant is expensive. Cut it when extra units tie up cash you need elsewhere.

Which safety stock calculation to use

If lead time barely moves, multiply the service factor by the demand standard deviation and by the square root of average lead time. This is a standard normal-distribution calculation. It assumes period demand is roughly bell-shaped, periods are independent, and lead time is stable enough that lead-time variance can stay out of the formula.

Safety stock = Z × demand standard deviation × square root of average lead time

When lead time varies, both swings belong inside the square root. Average demand is D, demand variance is the square of the demand standard deviation, and lead-time variance is the square of the lead-time standard deviation. This is the same family of standard normal calculations, with one added assumption covered next.

Safety stock = Z × square root of (average lead time × demand variance + average demand squared × lead-time variance)

Assumptions, including independent lead-time variation

The variable-lead-time formula assumes demand variation and lead-time variation are independent. It puts both swings inside one square root and treats them as separate, which sets their covariance to zero. A late receipt is not assumed to arrive in a high-demand week.

If demand spikes and supplier delays move together, this estimate can sit too low. If a late receipt tends to arrive in a quiet week, it can sit too high. Either pattern makes the safety stock calculation unreliable. Check purchase orders against weekly sales before you trust the number. Correlated demand and lead-time changes are a reason to drop this formula, not a reason to round it and reorder.

Both formulas also assume you measured demand and lead time in the same time unit, and that a normal curve is a fair sketch of demand during lead time. A handful of receipts, a launch, or a promotion breaks that sketch. Round a result you do trust up to the next whole unit. You cannot reorder a fraction of a unit, and rounding down spends the protection you just calculated.

Worked SKU example with assumed inputs

These figures are assumed inputs for a single variant, a ceramic pour-over kettle, so the arithmetic is easy to audit. They are not results from a store test. The example also assumes the independence condition above holds.

  • Average weekly demand: 20 units
  • Sample standard deviation of weekly demand: 5 units
  • Average lead time: 3 weeks
  • Sample standard deviation of lead time: 1 week
  • Service level: 95%, so Z = 1.65, the rounded standard normal quantile

Steady lead time, if you ignore the 1-week swing: 1.65 × 5 × square root of 3. The square root of 3 is 1.732, so 8.25 × 1.732 = 14.29. Round up to 15 units.

Lead time varies, and only if the swings are independent: 1.65 × square root of (3 × 25 + 20 squared × 1 squared) = 1.65 × square root of (75 + 400) = 1.65 × square root of 475. The square root of 475 is 21.79, and 1.65 × 21.79 = 35.95. Round up to 36 units.

MethodUse it whenBuffer in this example
Z × demand standard deviation × square root of lead timeReceipts land close to the average lead time, and demand during lead time is roughly normal15 units
Z × square root of (lead time × demand variance + demand squared × lead time variance)Receipt dates move, and demand variation is independent of lead-time variation36 units

The jump from 15 to 36 is the lead-time term, 400 inside the square root, not a change in sales. If your purchase orders show that pattern and the late weeks are not the same weeks demand jumps, the steady-lead-time formula will look tidy and still stock out. If those weeks do line up, do not use 36 either.

When a simple buffer fails

  • Two receipts are not a standard deviation. If you only have a couple of purchase orders, use the longest recent lead time as the planning lead time instead of a statistical lead-time swing.
  • Launch weeks, wholesale drops, and promotions are not a bell curve. A standard deviation from quiet weeks will understate the buffer. Calculate those weeks on their own, or set the buffer from the peak period rather than from the calm average.
  • If late receipts and high-demand weeks move together, the variable-lead-time formula is unreliable. Separate those periods, or plan with the longest recent lead time, instead of trusting the square-root result.
  • Negative ending quantity means the variant was oversold or was not tracked. Shopify documents both cases on the month-end snapshot. Fix tracking before you trust days of cover or a demand series built from bad on-hand counts.
  • A flat share of lead-time demand can hold you over for a week. Replace it once you have a service factor and a real lead-time spread. Otherwise every SKU carries the same guess.

Put the buffer to work this week

Run the variable-lead-time version for one A-grade variant whose last receipts missed the promise, and only if those late weeks are not the same weeks demand jumped. Keep demand and lead time in the same unit, round up, and do not add Incoming into the result.

Keep that unit count as the buffer. Compare it with Available stock, not with Incoming, and do not rebuild a reorder point on this page. Line the next purchase up with your replenishment cadence. Recalculate when the receipt pattern starts lining up with demand spikes, or after a promotion, because those events move the inputs and can break the independence assumption. If you would rather not keep the spreadsheet, Stock Intelligence can send stock alerts days before you run out and suggest a reorder quantity from supplier lead time, current sales pace, and upcoming trends.