How to calculate your e-commerce safety stock

Without stock there is no sale, however good your price is. Safety stock is the buffer that keeps you selling when a supplier runs late or demand suddenly jumps.
There are two ways to calculate safety stock. The basic method multiplies average daily demand by the possible days of delay: SS = (LTmax − LT) × D. The statistical method uses the variability of sales: SS = Z × σ × √LT, where Z depends on the service level (1.65 for 95%). The reorder point is SS + D × LT.
Key points
- Safety stock is the minimum number of units you hold to cover supplier delays and unexpected peaks in demand.
- The basic formula, SS = (LTmax − LT) × D, covers the worst lead time and usually gives high figures: it is a reference ceiling, not a target.
- The statistical formula, SS = Z × σ × √LT, sizes the buffer to the service level you choose and to how irregular the demand for each product is.
- The reorder point, ROP = SS + (D × LT), tells you how many units should be left in the warehouse when you place the next order.
- Moving from a 95% to a 99% service level raises safety stock by 40% in this article’s example: the last few percentage points of service level are the most expensive.
What is safety stock?
Safety stock is the minimum quantity of stock a shop keeps in the warehouse to meet demand when supply fails, when sales peak unexpectedly or when anything else happens that cannot be foreseen. Its purpose is to reduce the risk of a stock-out, that is, running out of units while orders are still waiting.
Each item needs its own calculation. A product that sells 50 units a day from a supplier that sometimes takes three times the agreed time is nothing like one that sells 3 units a week with reliable delivery. Sales, price, the space a product takes up and the supplier’s reliability all change the figure.
Holding too much also has a cost. Extra units tie up cash, take up warehouse space and, with perishable or fashion products, lose value over time. That is why safety stock always goes hand in hand with a second figure: the reorder point.
Why the reorder point matters
The reorder point is the stock level at which you should place a new order with the supplier so that the goods arrive before you have to dip into your safety stock. It works as a second line of defence against running out.
Two characteristics of the supplier determine how tight that point can be:
- Reliability: whether it responds and processes orders quickly, and whether it always has the products or sometimes runs out itself.
- Lead time: how long orders take to arrive and whether it meets the agreed deadlines.
The reorder point formula is:
ROP = SS + (D × LT)
- ROP: reorder point, in units.
- SS: safety stock, in units.
- D: average demand for the product, in units per day.
- LT: the supplier’s normal lead time, in days.
The term D × LT is what you expect to sell while the order is on its way. Safety stock is added on top to cover what you do not expect. Further down you will find worked examples with both formulas.
Other types of stock you may come across
Warehouse management uses other types of stock that are worth distinguishing from safety stock:
| Type of stock | What it is |
|---|---|
| Available stock | Units in the warehouse that can be sold right now, excluding those reserved for pending orders. |
| Stock in transit | Units ordered that are on their way from the supplier to your warehouse. |
| Seasonal stock | Units you build up before a peak season, such as Christmas or back to school. |
| Maximum stock | The highest level you want to hold of a product, usually safety stock plus one order. |
| Minimum stock | The level you do not want to fall below; in many companies it equals safety stock. |
| Work-in-progress stock | Raw materials and part-finished products waiting on the production line. |
| Cycle stock | Units consumed by normal sales between one order and the next. |
What is safety stock for?
Safety stock lets you keep selling when the flow of goods is interrupted or when you sell more than forecast. It protects you against:
- Higher demand than expected, due to a promotion, a mention on social media or a competitor running out of stock.
- Supplier problems, such as a late delivery caused by transport issues.
- Problems on the production line, yours or the supplier’s.
- External causes outside your control: strikes, port closures, pandemics or conflicts.
Managing safety stock is tied to the reorder point. Any change in safety stock shifts the moment you need to reorder, and vice versa: a slower supplier forces you to order earlier and keep a bigger buffer.
Advantages of holding safety stock
The main advantage is not losing sales, but it has other effects you will notice in the business:
- Keeping your customers’ trust: an out-of-stock product signals poor planning, especially if it keeps happening.
- Not pushing customers towards the competition: if you do not have the product, they will buy it elsewhere even if your price is lower.
- Offering better service: anticipating setbacks avoids cancellations and shipping delays.
- Competing on better terms: having stock when a rival runs out makes you the available option.
- Avoiding extra costs: without a buffer, a stock-out forces you to buy from more expensive suppliers or pay for express transport.
Risks of getting safety stock wrong
One risk of a poorly calculated safety stock is the cost of buying in advance and storing units that do not sell. That tied-up cash is not available for advertising, new product lines or discounts.
Perishable or seasonal products add another risk. With too much stock, the expiry date or the end of the season can arrive before you have sold the units, and you end up clearing them at a loss.
Falling short is just as dangerous as oversizing. A thin buffer protects little, and an excessive one turns surplus stock into a fixed cost. Calculating product by product is precisely how you find the middle ground.
Formulas to calculate safety stock
There are several safety stock formulas, and each one needs different data. The basic one only needs lead times and average demand; the statistical one also needs sales history to measure variability. The table summarises the three most widely used.
| Formula | Expression | Data you need | When to use it |
|---|---|---|---|
| Basic (maximum lead time) | SS = (LTmax − LT) × D | Supplier’s maximum and usual lead time, average demand | Little data, small catalogue, first calculation |
| Maximum and average | SS = (Dmax × LTmax) − (D × LT) | Maximum and average demand, maximum and usual lead time | Products with strong, well-known peaks |
| Statistical (service level) | SS = Z × σ × √LT | Standard deviation of daily demand, lead time, service level | Several months of sales history |
If the product is seasonal, calculate safety stock with data from the time of year you are in. A toy does not have the same average demand in December as in April, and mixing both periods into a single average gives a figure that is useless for either.
Basic formula: maximum lead time minus usual lead time
SS = (LTmax − LT) × D
- SS: safety stock.
- LTmax: the supplier’s maximum lead time when something goes wrong, in days.
- LT: usual lead time under normal circumstances, in days.
- D: average demand for the product, in units per day.
The basic formula covers the possible days of delay at average demand. It is easy to apply, but it assumes the worst delay you have seen will happen again, so it tends to oversize the buffer for suppliers that almost always deliver on time.
Maximum and average formula
SS = (Dmax × LTmax) − (D × LT)
The maximum and average formula combines the worst lead time with the worst daily demand (Dmax) and subtracts what you expect to sell under normal conditions. It protects against both problems at once, but it gives the highest figure of the three, because it assumes both happen at the same time.
Formula with standard deviation and service level
SS = Z × σ × √LT
- Z: factor linked to the service level, which is the probability of not running out of stock in each replenishment cycle.
- σ: standard deviation of daily demand, in units per day.
- LT: lead time, in days (in the same time unit as σ).
The statistical formula assumes that daily demand varies around its mean following, approximately, a normal distribution. The square root of the lead time appears because variability over several days does not add up day by day: some of the peaks are offset by slow days, as long as one day’s sales do not depend on the previous day’s.
The Z factor comes from the standard normal distribution. These are the most commonly used values:
| Service level | Z factor |
|---|---|
| 90% | 1.28 |
| 95% | 1.65 |
| 97.5% | 1.96 |
| 98% | 2.05 |
| 99% | 2.33 |
If the lead time also varies
When the supplier does not always meet the same lead time, the statistical formula is extended with the standard deviation of the lead time (σLT):
SS = Z × √(LT × σ² + D² × σLT²)
The first term captures demand variability and the second, lead time variability. The second often weighs more, because each day of delay multiplies the whole average demand: in example 4, the lead time contributes 10,000 of the 11,296 in the sum.
These formulas are not an invention of this article: they are the ones set out in operations and supply chain management textbooks, such as Supply Chain Management: Strategy, Planning, and Operation, by Sunil Chopra and Peter Meindl, and Inventory and Production Management in Supply Chains, by Edward Silver, David Pyke and Douglas Thomas.
Whichever formula you use, you need real data: ideally a full year of sales to see each product’s cycles. Warehouse management software or your ERP records stock movements in and out, and that same history gives you the average and the real maximum lead time of each supplier.
Examples of how to calculate safety stock
The following examples apply the formulas step by step. The first two use data from a fast-moving product; the third and fourth use a product whose sales standard deviation is known, to show the statistical method.
Example 1: safety stock with the basic formula
Product data:
- Maximum lead time in case of delay or incident (LTmax) = 30 days.
- Usual lead time (LT) = 7 days.
- Average demand (D), or the demand forecast for that time of year = 50 units/day.
SS = (30 days − 7 days) × 50 units/day = 23 × 50 = 1,150 units
The safety stock for this product is 1,150 units, which cover the 23 possible days of delay at 50 units a day.
Example 2: calculating the reorder point
With the safety stock from the previous example, the reorder point is calculated with ROP = SS + (D × LT):
- Safety stock (SS) = 1,150 units.
- Average demand (D) = 50 units/day.
- Normal lead time (LT) = 7 days.
ROP = 1,150 units + (50 units/day × 7 days) = 1,150 + 350 = 1,500 units
The new order should go out when 1,500 units are left in the warehouse. If the supplier meets the 7 days, the goods arrive just as stock falls to 1,150, without touching the buffer.
Example 3: safety stock with a 95% service level
Another shop sells a product with these figures, taken from its last few months of sales:
- Average demand (D) = 50 units/day.
- Standard deviation of daily demand (σ) = 12 units/day.
- Lead time (LT) = 9 days, so √LT = 3.
- Target service level = 95%, so Z = 1.65.
SS = 1.65 × 12 × 3 = 1.65 × 36 = 59.4 units, rounded up to 60 units.
ROP = 60 + (50 × 9) = 60 + 450 = 510 units.
If the shop wanted a 99% service level, the calculation would be 2.33 × 36 = 83.88, that is, 84 units. Raising the service level by four percentage points costs 24 more units of buffer, 40% more (84 / 60 = 1.4).
Example 4: when the supplier is also late
Same product, but the 9-day lead time has a standard deviation of 2 days (σLT = 2):
- LT × σ² = 9 × 12² = 9 × 144 = 1,296
- D² × σLT² = 50² × 2² = 2,500 × 4 = 10,000
- Sum = 11,296, and √11,296 = 106.28
SS = 1.65 × 106.28 = 175.4 units, rounded up to 176 units. The reorder point rises to 176 + 450 = 626 units.
The example shows that two days of variation in lead time almost triple the safety stock (from 60 to 176 units). Negotiating a more stable lead time with the supplier can save more warehouse space than fine-tuning the sales forecast.
Comparing the formulas on the same product
For comparison, the product in examples 3 and 4 has a maximum observed lead time of 14 days and a maximum demand of 75 units/day:
| Method | Calculation | Safety stock |
|---|---|---|
| Statistical, demand only (95%) | 1.65 × 12 × √9 | 60 units |
| Statistical, demand and lead time (95%) | 1.65 × √(9 × 12² + 50² × 2²) | 176 units |
| Basic | (14 − 9) × 50 | 250 units |
| Maximum and average | (75 × 14) − (50 × 9) = 1,050 − 450 | 600 units |
The four figures range from 60 to 600 units for the same product. The basic and maximum formulas are useful when there is no history or when the product is so important that no stock-out is acceptable; with enough data, the statistical method avoids paying for warehouse space for scenarios that almost never happen.
How to calculate minimum stock, maximum stock and the reorder point in Excel
Excel handles the calculation with one sheet per product or one row per SKU. With daily sales in column A (for example, A2:A181 for six months), these cells give the result of example 3:
| Cell | Figure | Formula |
|---|---|---|
| D2 | Average demand | =AVERAGE(A2:A181) |
| D3 | Standard deviation | =STDEV.S(A2:A181) |
| D4 | Lead time (days) | 9 |
| D5 | Service level | 0.95 |
| D6 | Safety stock (minimum stock) | =ROUNDUP(NORM.S.INV(D5)*D3*SQRT(D4),0) |
| D7 | Reorder point | =D2*D4+D6 |
| D8 | Quantity per order | 500 |
| D9 | Maximum stock | =D6+D8 |
The function names are those of English-language Excel (Microsoft’s help documents NORM.S.INV, STDEV.S and ROUNDUP); other language versions of Excel translate them, and some use a semicolon instead of a comma between arguments. NORM.S.INV(0.95) returns 1.645, so if D3 returns 12, D6 gives 59.2 rounded up to 60, the same result as in the example.
In this sheet, minimum stock equals safety stock and maximum stock is the buffer plus a full order: 60 + 500 = 560 units. If you have a large catalogue, inventory management software does the same calculation for every SKU and updates it with each sale.
Tips on calculating your safety stock
A well-calculated safety stock covers the expected maximum lead time without tying up more units than necessary. These practices help keep the figure realistic and stop it creeping up over time:
- Calculate by product and by season: recalculate the standard deviation with the comparable months of the previous year, not with the annual average.
- Classify your catalogue: apply high service levels (98-99%) only to the products that sell most or leave the most margin, and lower levels to the rest.
- Measure the supplier, not just demand: record the actual lead time of every order; as example 4 shows, its variability can weigh more than that of sales.
- Review the figure after every change: a promotion, a price cut or a new sales channel changes average demand and means you have to recalculate.
- Use software: inventory management tools with demand forecasting run the calculation for the whole catalogue and alert you when a product reaches its reorder point.
Peak sales dates deserve a separate calculation. Before campaigns such as Black Friday, review the stock of the products you are going to promote well in advance; you will find a preparation checklist in the keys to getting your e-commerce ready for Black Friday. And if the bottleneck is transport, the guide with tips to improve your online shop’s logistics may help.
Stock also affects margin: every unit in storage has a cost that comes off what you earn when you sell it. To find out how much each product really leaves you, go over how to calculate profit margin in e-commerce.
How do you stop a price change from draining your safety stock?
A price cut shifts demand and eats into the buffer sooner than planned, so it pays to know what is happening with market prices. Boardfy is a SaaS platform for competitor price monitoring and dynamic pricing for e-commerce, with direct price updates on Amazon, eBay, Google Shopping and Mirakl marketplaces.
- Boardfy reads your competitors’ prices every 6 hours, with competitor price monitoring.
- Boardfy keeps a price history, useful for explaining demand peaks when you recalculate.
- Boardfy applies dynamic pricing rules without ever going below your minimum price or margin.
Boardfy does not decide your strategy: it applies the rules you set. You can try Boardfy free for 7 days, no card required.