How much safety stock you actually need
Safety stock without the statistics degree: a practical buffer you can set per supplier, and when to change it.
Most people calculate safety stock backwards. They pick a buffer that feels right — "let's keep two weeks extra" — and then rationalize it. The formulas below reverse that: they size the buffer from two measurable things, how much your demand swings and how badly your suppliers slip. But they share a hidden flaw that matters more than which formula you pick: every classic safety stock formula assumes your sales history is complete, and yours probably isn't. We'll get to that, because fixing it is often worth more than choosing the "right" formula.
What safety stock actually buffers
Safety stock exists because two things are random:
- Demand during the lead time. Your SKU sells 6.2 units a day on average — but some 45-day stretches it sells 340 and some stretches it sells 210. The average hides the swing.
- Lead time. You place the PO expecting 30 days; the goods land in 38. Every extra day is ~6 more units you have to sell from buffer.
The two also gang up: demand spikes and supplier delays both cluster around the same events — busy seasons, promo windows, pre-holiday freight congestion. A buffer sized only for average demand on time will fail exactly when it matters. That's what the number is for: it converts "sometimes we're unlucky" into a specific quantity of units you hold, deliberately, per SKU.
The cost is real — buffer units are cash and shelf space — so the goal isn't maximum safety stock. It's a buffer matched to how much that particular SKU's stockout actually hurts.
Formula 1: the basic average rule
Safety stock = average daily sales × buffer days
Worked example: your green mug sells 6.2 units/day, and you want 7 days of buffer:
6.2 × 7 = 43.4 → 43–44 units
This is the "days of cover" approach, and it's fine — as long as you're honest that the buffer days are a judgment call, not a calculation. It's appropriate when:
- You don't yet have demand data granular enough for statistics (new SKU, short history).
- The product is cheap and easily substituted, so a stockout is an annoyance, not a wound.
- You're sanity-checking a fancier formula that produced something absurd.
Its weakness: it treats every SKU's variability as identical. A staple that sells 6 units every single day and a trend product that sells 0, 0, 30, 0, 4 need very different buffers, and this formula can't tell them apart.
Formula 2: the standard-deviation formula
The standard formula (you'll find it in any operations management textbook — it's common knowledge in the field) is:
Safety stock = Z × σ × √L
Where:
- σ (sigma) = the standard deviation of daily demand — how many units a typical day deviates from the average day. You can get it from a spreadsheet: export daily units sold for the SKU, and run
=STDEV.S()over the range. - L = lead time in days. Use your real measured average, not the supplier quote (see supplier lead time for measuring it).
- Z = your service-level factor: how often you're willing to run out. Z = 1.65 corresponds to a ~95% service level (stockout in roughly 1 of 20 replenishment cycles), 2.05 ≈ 98%, 1.28 ≈ 90%. This is a business decision, not a math decision: pick Z per SKU based on what running out costs you.
Note the √L: buffer needs grow with the square root of lead time, not linearly. Doubling a 45-day lead time does not double the demand-side buffer — it multiplies it by ~1.41. Long lead times punish you, but less brutally than a naive reading suggests.
Worked example. The mug: σ = 3.5 units/day (its daily sales swing between ~2 and ~13), L = 45 days, Z = 1.65.
Step 1: √45 = 6.708 Step 2: Z × σ = 1.65 × 3.5 = 5.775 Step 3: 5.775 × 6.708 = 38.7 → 39 units of safety stock
Compare with the basic rule's 43. Similar order of magnitude — reassuring — but the difference is that this number is derived from the SKU's actual swing. If the mug were a stable staple with σ = 1.2, the formula would give 1.65 × 1.2 × 6.708 = 13.3 → 13 units, and holding 44 would be over-buffering by five days of sales. If it were a spiky seller with σ = 8, the formula demands 1.65 × 8 × 6.708 = 88.5 → 89 units, and 7 "buffer days" would be quietly insufficient.
That sensitivity is the whole point: the standard-deviation formula charges volatile SKUs more and stable ones less. Use it for SKUs where stockouts hurt — your best sellers, your traffic drivers — and the basic rule for the long tail.
The censored-data problem: stockouts shrink your buffer
Here's the flaw we flagged at the top, and it's our own analysis rather than textbook material: every safety stock formula assumes your demand history shows what demand was. It doesn't. It shows what you were able to sell.
When a SKU is out of stock, Shopify records zero units sold on those days. But those weren't zero-demand days — demand existed and went unserved. The landmark 2002 out-of-stock study commissioned by the Grocery Manufacturers of America (Coca-Cola Retailing Research Council) found that of shoppers who hit an empty shelf, 31% went to another store, 26% bought the brand elsewhere, 19% substituted, 15% delayed the purchase, and 9% bought nothing. Your history for those days is censored: it's missing data at exactly the moments demand was strongest.
Small demonstration. Last month, 30 days, the mug was out of stock for 8 of them. You sold 155 units on the 22 days it was available.
- Naive daily average (what a spreadsheet over calendar days shows): 155 ÷ 30 = 5.2 units/day
- True in-stock velocity: 155 ÷ 22 = 7.05 units/day
The average is understated by ~26%. Now the second-order damage: those 8 zero-days sit inside the range you run STDEV.S() over. Zeros look like calm days. They pull σ down, so the standard-deviation formula — the "correct" one — computes a buffer for a SKU less volatile than the one you actually have. Both inputs to the formula are quietly wrong, and both errors point the same direction: too little buffer, on the SKUs most prone to selling out.
The fix is to compute velocity and σ from in-stock days only — the same correction we apply to reorder points in why your sales velocity numbers lie during stockouts. If you track your stockout days per SKU, exclude them from the denominator and from the σ range. If you don't track them, that's the first repair to make. Tracking stockout days per SKU is precisely what we built InventoryX to do — it's a ledger, not a guess — but a shared spreadsheet with one column per month, noting which dates each SKU was dark, works nearly as well. The days you were dark are the most valuable data points in your history, and right now Shopify records them as zeros.
Where the number goes in Shopify
Shopify has no native "safety stock" field, so you have to give the buffer a home yourself. Three practical options, in order of effort:
- Store it as a metafield on the product or variant (Shopify Help Center documents metafields; accessed Oct 2026). One custom field per variant —
safety_stock— keeps the number with the SKU, exportable and visible in the admin. This is the cleanest record even if nothing automates against it. - Use your low-stock alert threshold as the working copy. There is no native low-stock email alert in the core admin as of October 2026 (verified in the admin: Settings → Notifications covers customer, staff, and webhook notifications only), so merchants build one with a Shopify Flow automation or an alert app. Whatever fires the alert, set the threshold equal to your full reorder point — lead-time demand plus safety stock — and the alert is the buffer, operationalized. The alert fires, you order. The limits of that workflow are covered in low stock alerts on Shopify.
- Keep it in the buying spreadsheet, in the column the reorder point formula reads. Fine for one person; fragile when a teammate orders from a stale copy.
Whichever home you choose, revisit Z and the buffer quarterly. A service level is a dial, not a constant: 95% is a starting posture for a healthy cash position, and there's no shame in dropping cheap, substitutable SKUs to 90% to fund buffer where it matters.
Two questions this article gets asked in advance
"How do you calculate safety stock in one line?" If you only remember one version: buffer = daily sales × buffer days. It's the basic rule, it takes 30 seconds per SKU, and it beats holding no deliberate buffer at all. Just remember it's a starting estimate, and the standard-deviation version is the upgrade for SKUs whose stockouts genuinely cost you.
"How much safety stock do I need, as a percentage?" There's no universal percentage, and anyone quoting one ("keep 20% extra on everything") is flattening your catalog into a single risk profile. The honest version is per-SKU: a stable staple needs days of buffer; a volatile best-seller needs the Z-score math. If you want a rule of thumb for where to start: begin every SKU at the basic rule, then move your top sellers up to the standard-deviation formula and your dead-weight tail down. That is a far better use of an afternoon than applying one percentage and hoping.
Next step
Pick your five highest-velocity SKUs and compute both formulas for each. Where they disagree by more than ~25%, the standard-deviation number is the one to trust — provided σ came from in-stock days only. Then check each SKU's days of cover against its real lead time; a buffer you calculated last quarter may already be below the waterline.