← All articles
Advanced13 min read|

How to Stress-Test Your Margins Before Scaling: Monte Carlo Simulation for E-Commerce

Spreadsheets give you one answer. Monte Carlo simulation gives you thousands. Learn how probabilistic modeling reveals hidden risk in your e-commerce margins before you commit to scaling.

Every e-commerce financial model uses a spreadsheet. You plug in your expected price, volume, COGS, and CAC, and it gives you a single answer: your projected margin. The problem? That answer assumes every variable hits its exact estimate. In reality, none of them will.

The single-point estimate trap

Spreadsheets are deterministic. They give you one answer because you give them one set of inputs. But business reality is probabilistic:

  • Your COGS might increase 10% if your supplier raises prices
  • Your CAC might spike 30% during Q4 ad auction competition
  • Your volume might drop 20% if a competitor launches a similar product
  • Your refund rate might double after a quality issue

A spreadsheet forces you to pick one value for each. Monte Carlo simulation lets you model all of them simultaneously — as ranges, not points — and shows you the full distribution of possible outcomes.

Spreadsheet vs. Monte Carlo
Spreadsheet ModelMonte Carlo Simulation
InputsFixed point estimatesRanges with probability distributions
OutputSingle answerDistribution of possible outcomes
Answers the question"What is my expected margin?""What is the probability I lose money?"
Handles correlated risksPoorlyYes
Tail risk visibilityNoneFull distribution

What is Monte Carlo simulation?

Monte Carlo simulation is a technique that runs your financial model thousands of times, each time randomly sampling input values from the ranges you specify. Instead of producing one answer, it produces a distribution — a histogram of possible outcomes weighted by their probability.

Named after the Monte Carlo casino (because randomness is at its core), the method was originally developed for nuclear physics during the Manhattan Project. Today it is used in finance, engineering, insurance, and — increasingly — e-commerce margin analysis.

Here is how it works in practice:

  1. Define your variables — price, COGS, volume, CAC, refund rate — and give each one a range and volatility.
  2. Run thousands of iterations — in each run, the simulation randomly picks a value for each variable within its range.
  3. Calculate the outcome — for each set of random inputs, compute net operating income (or whatever metric you care about).
  4. Aggregate the results — plot all outcomes as a histogram. The shape tells you everything about your risk profile.

Setting up your simulation

The quality of a Monte Carlo simulation depends on how well you define your input variables. Each variable needs three things:

  • Base value — your best estimate (e.g., COGS = $18.00)
  • Volatility range — how much it could realistically vary (e.g., ±15%)
  • Distribution shape — how the values are spread within the range (uniform, normal, or skewed)
Simulation Input Variables
VariableBaseVolatilityRange
Price
$49.00±10%$44.10$53.90
COGS
$18.00±15%$15.30$21.60
Volume
1,000/mo±30%7001,400
CAC
$12.00±35%$8.40$18.00
Refund rate
5%±5pp2%10%

Notice the asymmetry in volatility: CAC has ±35% volatility because ad costs are highly variable, while price has only ±10% because you control it more directly. Volume at ±30% reflects demand uncertainty. These ranges should be informed by your historical data — look at month-over-month variation for each variable over the past 6–12 months.

Reading the results

After running 10,000 simulations with the variables above, you get a histogram of possible net operating income values:

Net Operating Income Distribution10,000 simulations
-$12k$0+$16k

P5

-$3.2k

Mean

$5.8k

P95

$14.1k

P(loss)

18%

This visualization tells a story no spreadsheet can:

  • The mean outcome is $5.8k — similar to what your spreadsheet predicted. But the mean is not the whole story.
  • P5 = -$3.2k — in the worst 5% of scenarios, you lose $3,200. Your spreadsheet never showed this possibility.
  • P95 = $14.1k — in the best 5% of scenarios, you make $14,100. There is upside too, but you need to survive to capture it.
  • P(loss) = 18% — there is an 18% chance you end the quarter with negative net operating income. Is that acceptable?

The red bars on the left side of the histogram represent loss scenarios. The more mass in that area, the riskier your growth plan.

Collapse Probability

18%

chance of negative NOI this quarter

Using Monte Carlo to evaluate growth plans

The real power of Monte Carlo simulation is comparative. Instead of asking "Will this growth plan work?" you can ask "Which growth plan has the best risk-adjusted return?"

Run the simulation under different strategic assumptions and compare:

Scenario Risk Comparison
Growth ScenarioP(loss)P5 (worst)MeanRisk
Current plan18%-$3.2k$5.8kmedium
+15% price increase8%$1.4k$9.2klow
2× volume, same CAC12%-$1.1k$11.6kmedium
2× volume, +20% CAC31%-$8.4k$4.1khigh

Look at the last two rows. Doubling volume at the same CAC is moderately risky (12% loss probability) with strong upside ($11.6k mean). But doubling volume with a 20% CAC increase — which is what often happens when you scale ads aggressively — flips the risk profile: 31% loss probability and a much lower mean.

Without Monte Carlo, both plans look like "growth." With it, you can see that the second plan has a nearly one-in-three chance of losing money. That changes the conversation.

Key metrics to track

When reviewing Monte Carlo results, focus on these four numbers:

P(loss) — probability of negative outcome

The single most important metric. What percentage of simulated scenarios result in a loss? Most operators are comfortable with 5–10%. Above 20% should trigger a plan adjustment.

P5 — the 5th percentile

Your "bad but plausible" scenario. If P5 is -$8,000, you need to be financially prepared to absorb that loss. If your working capital cannot handle it, the growth plan is too aggressive.

Mean — the expected value

The probability-weighted average of all outcomes. This is closest to what your spreadsheet predicts, and it is useful for long-run planning. But never use it alone — a high mean with a high P(loss) is a gamble, not a plan.

P95 — the 95th percentile

Your upside scenario. Useful for capacity planning: if things go very well, can you fulfill the demand? P95 tells you what "very well" actually looks like.

Common pitfalls

Using unrealistically narrow ranges

If you set volatility to ±5% on everything, your simulation will look great — and will be useless. Use your actual historical variance. If your CAC bounced between $8 and $20 over the past year, that is your range.

Ignoring correlations

Some variables move together. When your ad spend increases, both volume and CAC tend to increase. A naive simulation treats them as independent, which can understate risk. Advanced Monte Carlo models let you specify correlations between variables.

Running too few iterations

With 100 iterations, your results are noisy. With 1,000, they are directionally useful. With 10,000+, they are reliable. More iterations mean smoother distributions and more stable percentile estimates.

Treating the output as prediction

Monte Carlo does not predict the future. It maps the range of possible futures given your assumptions. The assumptions matter more than the math. Garbage in, garbage out — but at least Monte Carlo shows you the shape of the garbage.

Getting started with stress testing

You do not need a statistics degree to run Monte Carlo simulations on your margins. The setup is straightforward:

  1. Calculate your true unit economics per SKU
  2. Estimate volatility for each variable based on historical data
  3. Run the simulation and review the loss probability
  4. Compare scenarios before committing to a growth plan

MarginCaptain runs up to 100,000 Monte Carlo simulations per stress test — with per-variable volatility controls, full surplus distributions, and scenario comparison built in. No spreadsheet formulas, no custom code.

Try the interactive demo to run a stress test on sample data and see how the distribution changes as you adjust volatility.

Find your fake-profitable SKUs.

Upload your Shopify data. Get your margin leak audit in minutes.