How do I calculate my real net margin including every hidden cost?
Calculate net margin in ecommerce by subtracting COGS, payment fees, blended shipping, a returns provision, and variable marketing from revenue, then dividing by revenue.
Last updated: June 27, 2026
To calculate net margin in ecommerce, start with revenue and subtract every cost that scales with the order: cost of goods, payment fees, blended shipping and fulfillment, a returns provision, and variable marketing. Divide what is left by revenue. That percentage is your real net margin, and it is usually far below the gross figure most merchants quote.
Most margin advice stops at gross margin, which is revenue minus cost of goods. Gross margin is the number you say out loud, and it is also the number that flatters you into thinking thin orders are healthy. The real net-margin formula keeps subtracting until nothing variable is left. This post lays out that full formula, names the lines merchants routinely drop, runs the math on a coffee subscription down to dollars left, and shows you how to find your own figure.
What is the net margin formula for an ecommerce order?
The net margin formula for an ecommerce order is revenue minus COGS minus payment fees minus blended shipping and fulfillment minus a returns provision minus variable marketing, all divided by revenue. Net margin counts every cost that moves with the order, not just the cost of the product itself.
Here it is in plain terms.
Net margin $ = Revenue − COGS − Payment fees − Shipping & fulfillment − Returns provision − Variable marketing
Net margin % = Net margin $ / Revenue
Two distinctions matter before you run it. Contribution margin is revenue minus only the costs that vary with the unit sold, and net margin per order is that same idea taken to its honest end, before fixed overhead like rent and salaries. Gross margin, the figure most merchants quote, stops after COGS and ignores four lines that quietly drain the order. Those four are where the real money goes.
Which hidden costs do merchants leave out of net margin?
Merchants leave four costs out of net margin most often: payment fees, the full blended shipping cost, a returns provision, and variable marketing or customer acquisition cost. Each one is real cash leaving the business on every order, and each one is invisible on a gross-margin line.
Here is what each hidden line actually covers.
| Hidden cost | What it really includes | Why it gets dropped |
|---|---|---|
| Payment fees | Processor percentage plus the fixed per-transaction fee, on every order | Treated as a tiny rounding error, not a per-order cost |
| Blended shipping | True average outbound cost across zones, weights, and carrier re-rates, not the cheapest label | Merchants quote the published rate, not the invoice |
| Returns provision | Expected cost of refunds, replacements, and failed deliveries, spread across all orders | Returns hit a different month than the sale |
| Variable marketing | Customer acquisition cost and ad spend allocated per order | Booked as a marketing budget, never attributed to the order |
Carrier re-rates deserve a flag of their own. The label you buy at checkout is an estimate, and the carrier reweighs and remeasures the parcel, then bills the difference days later as an adjustment. That adjustment never appears next to the order in Shopify, so the order looks more profitable than it was. A blended shipping cost pulled from your actual carrier invoices, re-rates included, is the only honest input.
How do I calculate net margin step by step?
Calculate net margin in five subtractions from revenue, then one division. Run them in order so each line builds on the last.
Step 1: Start with order revenue
Use the price the customer actually paid, after any discount code or promotion. A 20 percent off coupon lowers revenue before any cost is counted, so net margin on a discounted order starts from a smaller base.
Step 2: Subtract cost of goods sold
Subtract the landed unit cost of everything that ships: the product, packaging, inserts, and any per-unit duty or import cost. Landed COGS, not factory COGS, is what leaves your bank account.
Step 3: Subtract payment fees
Subtract the processor percentage plus the fixed fee. At 2.9 percent plus 30 cents, a $25 order costs 73 cents plus 30 cents, which is $1.03. Small per order, real across thousands.
Step 4: Subtract blended shipping and fulfillment
Subtract your true average outbound cost: pick-and-pack labor plus the blended carrier cost including re-rates. Pull total fulfillment and shipping spend for a period from your carrier invoices and divide by orders shipped.
Step 5: Subtract a returns provision and variable marketing
Subtract the expected returns cost spread across every order, then subtract the variable marketing or acquisition cost allocated to the order. Whatever remains is net margin in dollars. Divide it by revenue for net margin percent.
Worked example: a single-origin coffee subscription at $25 a month
Take a single-origin coffee bean bag subscription that bills $25 a month, and walk one monthly order all the way down to dollars left.
| Line | Amount |
|---|---|
| Revenue (one monthly bill) | $25.00 |
| Cost of goods (green beans, roasting, bag, valve, label) | -$9.25 |
| Payment fee (2.9% + $0.30) | -$1.03 |
| Shipping and fulfillment (pick-pack + blended carrier with re-rates) | -$6.40 |
| Returns provision (failed deliveries and replacements) | -$0.31 |
| Variable marketing (acquisition cost per billing cycle) | -$2.10 |
| Dollars left (net margin) | $5.91 |
The math, line by line. Revenue is $25.00. Subtract $9.25 of landed COGS and you have $15.75 left, which is a gross margin of 15.75 divided by 25, or 63.0 percent. That 63 percent is the number this merchant would quote. Now keep going. Subtract the $1.03 payment fee to reach $14.72. Subtract $6.40 of blended shipping and fulfillment to reach $8.32. Subtract the $0.31 returns provision to reach $8.01. Subtract $2.10 of variable marketing and you land on $5.91 of dollars left.
Net margin is 5.91 divided by 25, which is 23.6 percent. The merchant who says this subscription runs at a 63 percent margin is off by 39.4 percentage points, because gross margin ignored $9.84 of real per-order cost. On a $25 order, $5.91 survives to cover rent, salaries, software, and profit. Drop the acquisition cost or skip the returns provision, as a gross-margin view does, and the same order looks like it clears $8.01 or $8.32, overstating health by a third or more.
How do I find my own net margin figure?
Find your own net margin by pulling four real numbers for a recent period and dividing them into per-order costs. Use actuals, not estimates, because the estimates are exactly what hides the leak.
- Landed COGS per unit, from your supplier invoices including packaging and any duty.
- Blended shipping and fulfillment, from total carrier and 3PL spend with re-rate adjustments divided by orders shipped.
- Returns provision, from total refund and replacement cost over a quarter divided by total orders in that quarter.
- Variable marketing per order, from total variable ad and acquisition spend divided by orders acquired.
Plug those into the formula and you get a blended net margin. The trap is that a blended average hides the worst orders. The same catalog can carry 35 percent net margin on full-price multipacks and negative net margin on single discounted units with a heavy parcel. To see that spread, calculate net margin per order rather than per catalog, and break it down by margin by SKU, channel, and customer. The orders that fall below zero are the ones to find first, covered in which orders are unprofitable.
What does it cost to skip this calculation?
Skipping the full net-margin calculation costs you the difference between the gross figure you quote and the net figure you actually earn, on every order, undetected until month-end. On the coffee subscription that gap is 39.4 percentage points, or $9.84 a box.
Run a thin scenario to see the danger. Suppose a promotion knocks $4 off that $25 box and a heavier two-bag parcel pushes blended shipping to $9.10. Revenue falls to $21, COGS rises to $18.50 for two bags, the payment fee drops to $0.91, and shipping is $9.10. Before returns and marketing, contribution is 21 minus 18.50 minus 0.91 minus 9.10, which is negative $2.51. Subtract the returns provision and acquisition cost and the order is deep underwater. On a gross-margin view that promoted order still shows a positive product margin, so nobody stops it. Repeated across a subscription base billing monthly, that single blind spot compounds twelve times a year. Catching it early is the whole point of detecting margin erosion before it spreads, and the wider gap between top-line revenue and real net margin is laid out in Shopify revenue versus net margin.
The Agentis figure: a 39-point gap between gross and net
Run the coffee subscription and one number frames the entire problem. Gross margin reads 63.0 percent and real net margin reads 23.6 percent, a gap of 39.4 percentage points, computed as 63.0 minus 23.6. That gap is not an error in the math. It is the sum of four costs that gross margin refuses to count: a $1.03 payment fee, $6.40 of blended shipping, a $0.31 returns provision, and $2.10 of variable marketing, which together total $9.84 per order.
On one clean order the gap is a known quantity. Across a live subscription base with promotions, carrier re-rates, address corrections, and mixed cart sizes, the per-order net margin shifts with every bill, and the gap nobody is watching is where the money goes.
Agentis is a real-time profit governance platform for high-volume Shopify Plus and ShopLine merchants. It monitors margin at the order and SKU level and flags or blocks unprofitable activity before it reaches the P&L. Profit governance is the practice of monitoring and enforcing margin rules in real time across every order, SKU, and channel, so unprofitable activity gets caught and corrected as it happens instead of discovered in a month-end report. For net margin, that means the promoted, heavy, or thinly-priced order that drops below your floor gets caught on the day it ships, not in a quarter-end review.
Frequently asked questions
What is the difference between gross margin and net margin in ecommerce?
Gross margin is revenue minus cost of goods sold, divided by revenue. Net margin keeps subtracting every variable cost: payment fees, blended shipping, a returns provision, and variable marketing. On the coffee subscription above, gross margin was 63.0 percent while net margin was 23.6 percent, a 39.4-point gap that is pure hidden cost.
How do I calculate net margin when I do not know my returns cost?
Estimate a returns provision by taking total refund and replacement cost over a recent quarter and dividing by total orders in that quarter, then apply that per-order figure to every order. The provision spreads an irregular cost evenly so net margin reflects it, even on orders that are never returned. Refine the figure as you collect more return data.
Should I include marketing in net margin per order?
Include only variable marketing, meaning ad and acquisition spend that scales with orders, allocated per order. Leave out fixed marketing like salaries and retainers, which belong below net margin with the rest of overhead. Variable customer acquisition cost is a real per-order cost, so a net-margin figure that omits it overstates the profit on every newly acquired customer.
Why is my net margin lower than my gross margin?
Net margin is lower than gross margin because gross margin stops after cost of goods, while net margin also subtracts payment fees, blended shipping with carrier re-rates, a returns provision, and variable marketing. Those four lines are real cash that leaves on every order, so the more of them you carry, the wider the gap. A 30 to 40 point gap between gross and net is common in shipped-product ecommerce.
What net margin is healthy for an ecommerce subscription?
A healthy net margin depends on your acquisition cost and retention, but for a shipped consumable subscription, a per-order net margin in the low-to-mid twenties leaves room to cover overhead and profit once a customer stays several cycles. The figure that matters is whether net margin stays positive after a discount and a heavy parcel, not the average, since the thin orders are the ones that quietly turn negative.
Next step you can take today: pull one recent order, subtract landed COGS, the payment fee, your blended shipping from the carrier invoice, a returns provision, and the variable acquisition cost, then divide what is left by revenue. Compare that net margin to the gross figure you usually quote, and the size of the gap tells you how much hidden cost you have been ignoring.