All articles Forecasting

How to Set Safety Stock Without Guessing

By David Prats

Safety stock = Z × square root of [(average lead time × demand variance) + (average demand² × lead time variance)]. That is the formula. Everything else in this article explains what each variable means, how to calculate it, and what happens when one of them is estimated poorly.

The formula and its variables

For a replenishment item, a practical safety stock formula is:

Safety stock = Z × √[(L × σd²) + (d² × σL²)]

Here, Z is the service level factor, L is average lead time in days, σd is the standard deviation of daily demand, d is average daily demand, and σL is the standard deviation of lead time in days.

The first term, L × σd², represents demand uncertainty during the time you are waiting for replenishment. If customers buy more or fewer units than usual, the required buffer increases. The second term, d² × σL², represents the effect of suppliers taking longer or less time than usual to deliver. If daily demand is high, even a small change in lead time can create a material stock requirement.

This version assumes that demand variation and lead time variation are independent. That is a reasonable starting point for many retailers. If a supplier also tends to arrive late during the same periods when demand rises, the two sources of uncertainty are correlated. In that case, this formula can understate the required buffer. A retailer with that pattern should model the joint historical distribution or add a management adjustment based on observed service failures.

The Z value converts a desired service level into inventory. A 95% cycle service level means the retailer aims to have enough stock to avoid a stockout during the replenishment cycle in 95% of cases. It does not mean that 95% of all customer demand will be fulfilled across every channel and every day.

Target cycle service levelZ score
90%1.28
95%1.65
98%2.05
99%2.33

The choice of service level should reflect margin, substitution options, replenishment frequency, and the cost of being out of stock. It should not be selected because a higher percentage sounds safer.

Calculating standard deviation of daily demand

Demand variability should come from the same selling pattern that the stock policy is intended to cover. The calculation is simple, but the data preparation determines whether the result is useful.

  1. Choose a relevant history. Start with at least 12 months of daily sales where possible. This captures weekly patterns and gives you a chance to observe seasonal periods. For a new item, use a comparable product or category, then replace the estimate as soon as enough item history exists.

  2. Build a daily series for each stock keeping unit and location. Include days with zero sales. Removing zero sales days makes demand look more consistent than it is and will reduce safety stock artificially.

  3. Correct for stockouts. Recorded sales are not the same as unconstrained demand. If an item was unavailable for two days, zero sales on those days do not indicate zero customer demand. Mark those dates and either estimate lost demand from nearby comparable days or exclude the affected period from the initial calculation.

  4. Separate unusual commercial events. Promotions, store openings, closures, clearance activity, and one-off bulk orders should not be mixed into a normal replenishment policy without adjustment. You can calculate separate demand profiles for promotional and non-promotional periods, or use a forecast that explicitly includes the event.

  5. Calculate the mean and standard deviation. If the daily observations are d1 through dn, average daily demand is the sum of all observations divided by n. The sample standard deviation is the square root of the sum of each observation's squared difference from the mean, divided by n minus 1.

For example, suppose a product sold 18, 22, 15, 25, and 20 units across five comparable days. The average is 20 units per day. The sample standard deviation is approximately 3.8 units per day. In a real policy, five days is too little history for a stable estimate, but the example shows the calculation.

Use the demand series at the level where the replenishment decision is made. If each store orders independently, calculate variability by store. If a central warehouse replenishes the whole network, calculate demand at the warehouse level, while considering store allocation and transfer delays separately. Aggregating too early can hide local stockout risk. Aggregating too late can produce unnecessary buffers when locations can share inventory.

Seasonality also needs attention. A single annual standard deviation can be misleading when Q4 demand is much more variable than demand in the rest of the year. Calculate the parameter by season, month, or a rolling window that reflects the upcoming selling period. Safety stock is a current operating parameter, not a permanent characteristic of the product.

Adding lead time variability

Lead time is the number of calendar days between placing an order and having sellable stock available. Use actual receipt dates, not the supplier's stated target. Include weekends, customs delays, receiving time, and quality checks if they affect when the item can be sold.

For each purchase order, record the actual lead time. Calculate the average lead time L and its standard deviation σL. A convenient way to monitor supplier consistency is the coefficient of variation:

Lead time coefficient of variation = σL ÷ L

If the coefficient of variation is known, calculate lead time standard deviation as:

σL = lead time coefficient of variation × average lead time

This can then be inserted into the safety stock formula. The coefficient of variation makes comparisons easier. A supplier with a 4 day standard deviation on a 40 day average lead time has the same relative variation as a supplier with a 2 day standard deviation on a 20 day average lead time, because both have a coefficient of variation of 10%.

Use enough purchase orders to avoid overreacting to one late shipment. Twelve observations are a basic starting point, but a larger history is preferable. Segment the data when shipping method, supplier site, origin country, or product class changes. A switch from road freight to air freight should not be treated as ordinary noise in one combined series.

Worked scenario: a six store footwear retailer

Consider a synthetic mid-size footwear retailer with six stores and a central replenishment point. A seasonal footwear style is supplied from Morocco. Over the relevant period, average demand at the network level is 40 units per day, with a daily demand standard deviation of 12 units. Actual supplier lead times average 20 days and usually range from 15 to 25 days. The retailer measures a lead time standard deviation of 3 days.

At a 95% cycle service level, Z is 1.65. The demand uncertainty term is:

20 × 12² = 2,880

The lead time uncertainty term is:

40² × 3² = 14,400

The combined standard deviation is the square root of 17,280, or approximately 131 units. Safety stock is therefore:

1.65 × 131 = approximately 216 units

The result may appear high, but lead time variation is the main reason. The demand component alone would produce a buffer of 1.65 × square root of 2,880, or approximately 89 units. The supplier's delivery variation adds substantial risk because the retailer sells 40 units each day while waiting.

During Q4, suppose daily demand variation rises from 12 units to 20 units while the supplier pattern remains unchanged. The demand term becomes 20 × 20², or 8,000. Combined with the lead time term of 14,400, the buffer at 95% service becomes approximately 1.65 × 150, or 248 units. The retailer should not carry that Q4 level throughout the year. It should use a seasonal parameter and reduce the buffer when demand variability returns to normal.

The same item at a 99% service level would require approximately 305 units under the original conditions, using Z = 2.33. That additional stock may be justified for a critical basic style with no substitutes. For a fashion item with markdown risk and a short selling window, it may create more excess inventory than it prevents in lost sales.

When a fixed number is acceptable

Formula-based safety stock is not mandatory in every situation. A fixed quantity can be appropriate when demand is very stable, lead time is very short, and replenishment occurs frequently. For example, a store that sells a consistent number of packaging units each day and receives replenishment locally within one day may use a fixed buffer that is easy for staff to manage.

Fixed safety stock can also be reasonable for low value items where the cost of maintaining a detailed calculation exceeds the value of the improvement. The decision should still be checked against actual stockouts and excess stock. A fixed number is a policy choice, not evidence that variability is zero.

For items with seasonal demand, intermittent sales, long supplier lead times, frequent promotions, or a history of late receipts, a fixed number is harder to defend. It may work for one period and fail in the next because the underlying inputs have changed.

The service level counterpoint

Choosing 99% for every item is a common response to stockout pressure, but it is usually too expensive for independent and mid-size retailers. Moving from 95% to 99% increases Z from 1.65 to 2.33, a rise of about 41%. The required safety stock does not increase by exactly 41% in every practical case because the base stock policy and rounding rules also matter, but the buffer can become materially larger.

A tiered policy is more practical. Use a higher service target for core products with strong repeat demand and limited substitution. Use a lower target for long-tail products, fashion items, or products with high markdown exposure. Review the target by category and channel rather than assigning one percentage to the whole catalogue.

Recalculate demand variability at least monthly for fast moving seasonal items, and at least quarterly for stable items. Recalculate lead time variability whenever the supplier, route, order frequency, or receiving process changes. The most common failure is leaving last year's safety stock in place after a promotion, season, or supplier change has altered the data.

Stockagile puts this into practice

Inventory planning tools built for independent and multichannel retailers. Start a free trial to see how it fits your stores.

Start free trial

More from Insights