Operators' Playbook20 November 2026 · 12 min read

Profit margin formula for ecommerce: gross, contribution and the per-product margin nobody computes

The profit margin formula is simple; the margin that matters is not. One €40 product goes from a 60% gross margin to 19% once the order is paid for. The formulas, the benchmarks by sector, and how to find your own per-product number.

Konstantinos Gkolias

Konstantinos Gkolias

Founder, building Lumnya

Operators' Playbook

The margin after the order

Lumnyaai

The profit margin formula is simple: what you keep, divided by what you sold. The trouble is that "what you keep" depends on how many costs you subtract, and most online stores stop too early. A product with a healthy 60% gross margin can end up with a 19% contribution margin once card fees, shipping, packaging, returns and advertising are paid for, and a 20% discount can take that to almost nothing. This piece gives you every margin formula a store needs, with worked numbers, shows how US retailers' margins compare, and explains the one margin worth computing per product, every week.

What is the profit margin formula?

Profit margin is profit divided by revenue, expressed as a percentage:

> Profit margin = (Revenue − Costs) ÷ Revenue × 100

The word "costs" is where the different margins come from. Subtract only what the goods cost you and you get gross margin. Subtract everything a single order costs you and you get contribution margin. Subtract everything the business costs you, including salaries, software and tax, and you get net margin. Each answers a different question, and confusing them is the most common pricing mistake in ecommerce.

The four formulas a store needs

1. Gross margin

> Gross margin = (Price − Cost of goods) ÷ Price

If you sell a product for 40 euros and it costs you 16 euros to buy or make, your gross margin is (40 − 16) ÷ 40 = 60%. It tells you how much room the price leaves above the product's own cost. It says nothing about whether an order is profitable.

On Shopify, gross margin per product only works if the cost is recorded. Shopify has a cost per item field on every product, and its profit reports depend on that field: Shopify reports profit for the products where a cost has been recorded. In our experience, it is the field most stores leave empty.

2. Markup (and why it is not margin)

> Markup = (Price − Cost) ÷ Cost

Markup measures the same gap against cost instead of price. The 40-euro product with a 16-euro cost has a markup of 150% and a margin of 60%. The two are linked by a fixed relationship:

> Margin = Markup ÷ (1 + Markup) · Markup = Margin ÷ (1 − Margin)

Markup against margin for the same prices: a 25% markup is a 20% margin, 50% is 33%, 100% is 50%, 150% is 60%, 200% is 67% and 300% is 75%.

This matters when a supplier, a wholesaler or a pricing app talks in one and you think in the other. "We double the cost" is a 100% markup and a 50% margin. A margin can never reach 100%; a markup has no ceiling. Free calculators such as Shopify's profit margin calculator do the conversion, but it is worth knowing by heart.

3. Contribution margin per order

> Contribution margin = (Price − All variable costs of the order) ÷ Price

Variable costs are the ones that come with each sale: the goods, the payment fee, shipping you pay for, packaging, the expected cost of returns, and the advertising it took to win the order. This is the margin that tells you whether selling one more unit makes you money.

4. Net margin

> Net margin = Net profit ÷ Revenue

Net profit is what is left after every cost of running the business, including fixed costs that do not change with each order (salaries, rent, software subscriptions) and tax. It is the margin your accountant reports once a year. It is too late and too aggregated to guide a pricing decision on a single product. Net margin is the scoreboard; contribution margin is how you play the game, product by product and week by week.

How do real retailers' margins compare?

The gap between gross and net margin is easiest to see in public companies' accounts. Aswath Damodaran at NYU Stern publishes margins by industry for US listed companies, updated every January as part of his annual data sets.

Gross and net margins of US listed companies by sector, January 2026: apparel 57% and 3.9%, household products 51% and 11.7%, specialty retail 35% and 5.2%, general retail 33% and 5.6%, distributors 31% and 6.0%, grocery 26% and 1.3%, total market 38% and 9.7%.

Apparel companies keep 57 cents of every dollar after the cost of their goods, and under 4 cents after everything else. Specialty retailers keep 35 cents gross and about 5 net. These are large firms with buying power a small store does not have, so they are a reference point, not a target. The lesson carries over anyway: a high gross margin is the start of a profitable product, not the proof of one. Most of what sits between the two dots is the cost of getting and serving each order.

A worked example: from a 60% gross margin to 19%

Here is one product, priced at 40 euros, followed from price to contribution. Every cost except the card fee is an assumption, chosen to be typical rather than extreme; replace them with your own. The card fee is the Shopify Payments online rate shown to an EU visitor on the Basic plan, 1.9% plus 25 cents per payment; rates vary by country and plan.

One illustrative 40-euro product from price to contribution margin: cost of goods 16, card fee 1.01, shipping 4.50, packaging 0.80, returns 3.20, ad cost 7.00, leaving 7.49, an 18.7% contribution margin.
StepAmount (EUR)Margin left
Price40.00100%
After cost of goods24.0060.0% (gross margin)
After card fee (1.9% + 0.25)22.9957.5%
After shipping you pay18.4946.2%
After packaging17.6944.2%
After expected returns (8% of revenue)14.4936.2%
After ad cost per order7.4918.7% (contribution margin)

Two things stand out. The largest single cost after the goods themselves is advertising, which never appears in a product's gross margin. And the per-order costs are partly fixed: shipping, packaging and the 25-cent fee cost the same on a cheap order as an expensive one, so low-priced products lose a larger share of their margin to them.

What a discount really costs

Now offer that product at 20% off. The price falls to 32 euros, the cost of goods does not move, and most of the per-order costs stay where they were.

Full price20% off
Price40.0032.00
Contribution per order7.490.28
Contribution margin18.7%0.9%

A 20% discount does not cut this product's profit by 20%. It cuts it by 96%. To make the same total contribution at the discounted price, you would need to sell about 27 times as many units, which no promotion delivers. The usual rule of thumb (with margin m and discount d, you need m ÷ (m − d) times the volume to break even) uses gross margin and would say 1.5 times. It understates the damage because it ignores the per-order costs.

This is why a store-wide sale is so expensive, and why we argued for clearing slow stock narrowly instead, one product at a time with a floor under the price, in Clear dead stock before Black Friday.

The margin nobody computes: contribution per product, every week

Most stores know their overall gross margin and their annual net margin. Few know the contribution margin of each product, and fewer still watch it change. It changes more than people expect:

  • Costs move. A supplier's price rises, a shipping rate changes, a currency shifts. Gross margin falls without anyone touching the price.
  • Advertising cost per order moves. When an ad campaign gets more expensive, the products it sells become less profitable, sometimes negative, while revenue looks healthy.
  • The mix moves. If your best-selling product is also your thinnest, a good month can make less money than a quieter one.

A practical routine, using whatever tools you already have:

  • Fill in the cost of every product that sells. Without it, no margin figure means anything. Start with the twenty products that make most of your revenue.
  • Estimate per-order costs once. Average shipping cost, packaging, payment fee rate, return rate by category, ad spend divided by orders. Rough numbers are far better than none.
  • Compute contribution margin per product with the formula above, in a spreadsheet if need be.
  • Mark three groups: products that lose money per order, products under about 15% (thin enough that one cost increase or one discount turns them negative), and the rest.
  • Repeat monthly, and after any change. A new supplier price, a new shipping rate or a new ad campaign is enough to move a product from healthy to thin. The routine takes an hour once the costs are recorded, and it is the hour that tells you which products are paying for the others.
  • Act on the first two groups before running any promotion: raise the price, cut the cost, stop advertising them, or bundle them with something healthier.

Five ways to raise contribution margin without raising prices

A price rise is the bluntest tool. These five usually come first, and each one moves a specific line of the waterfall above.

1. Sell more per order. Shipping, packaging and the fixed part of the card fee are paid once per order, so a second item in the same box carries almost none of them. Bundles of products that are already bought together, and a free-shipping threshold set just above your typical basket, raise contribution far more than they cost. Set the threshold from your own order data, not from what competitors show.

2. Cut returns at the source. Returns are often the third-largest variable cost, and many start with a product page that did not answer a question: the size, the material, what is in the box. Every answer you add is a return you may avoid. The same goes for anything an AI assistant says on your behalf; a wrong answer about a product becomes a return, which is why we argued for checking each claim against a record in AI hallucination.

3. Move ad spend to the products that can afford it. Advertising cost per order is usually set by campaign, not by product, so thin-margin products often receive the same spend as healthy ones. Once you know each product's contribution margin, shift budget towards the products that keep more of each order.

4. Buy better, not just cheaper. Supplier price is the biggest cost, and the cost of running out is part of it: an emergency reorder with express freight can wipe out a product's margin for a month. Planning reorders against the season, as in Black Friday inventory planning, protects margin as much as negotiating does.

5. Stock what people ask for. Products you add because shoppers kept asking for them tend to sell without much advertising, which makes them unusually high-contribution. We described how to count those requests honestly in What your shoppers ask for that you don't sell.

None of these needs new software. All of them need the per-product numbers from the routine above.

How Lumnya helps

Lumnya's Profit Lens agent does steps 1, 3 and 4 for a Shopify store, continuously:

  • It computes the margin of every product from the cost recorded in Shopify, or from a cost you enter in Lumnya, which always takes precedence.
  • It flags the products that lose money and the ones with thin margins, so you see them before a sale or an ad push makes them worse.
  • It asks for missing costs on the products that sell. A product without a cost is not counted as healthy or unhealthy; Lumnya recommends filling it in, starting with the products that actually have orders.
  • Your costs stay yours. Cost and margin figures are shown only to the merchant. They never reach the storefront assistant or anything a shopper can see.

The margin math is ordinary arithmetic, written in code, with no AI model guessing at it. You can see what Profit Lens and the other agents do on Lumnya's agents page.

Where we could be wrong

The worked example uses assumed costs, and your mix of shipping, returns and advertising may be very different; a store with no paid advertising will see a much healthier contribution margin. Damodaran's figures come from large listed companies and include costs a small store does not have, and leave out some it does. Attributing advertising cost to individual products is genuinely hard when a campaign sells many of them, and any per-product figure is an estimate. And contribution margin is not the whole story: a low-margin product that brings in new customers who later buy high-margin ones can be worth keeping. The point is to know the number, not to delete everything below a threshold.

The short version

  • Profit margin = (revenue − costs) ÷ revenue. Which costs you subtract decides which margin you get: gross (goods only), contribution (everything an order costs), net (everything the business costs).
  • Margin = markup ÷ (1 + markup). A 100% markup is a 50% margin.
  • US apparel companies keep 57% gross and under 4% net. Most of the gap is the cost of getting and serving orders.
  • A product with a 60% gross margin can end at 19% contribution, and a 20% discount can take it to under 1%.
  • Compute contribution margin per product, mark the losers and the thin ones, and fix them before any sale.

Frequently asked questions

What is the formula for profit margin?

Profit margin equals profit divided by revenue, times 100. Gross margin uses revenue minus the cost of goods; contribution margin subtracts every variable cost of an order; net margin subtracts every cost of the business, including fixed costs and tax.

What is a good profit margin for an online store?

It depends on the category and the business model, so treat any single number with caution. As a reference, US listed apparel companies averaged a 57% gross margin and under 4% net margin in January 2026, and specialty retailers 35% gross and about 5% net. For an individual product, a contribution margin under about 15% leaves little room for a cost increase or a discount.

What is the difference between margin and markup?

Both measure the gap between price and cost. Margin divides it by the price, markup by the cost. A product that costs 50 and sells for 100 has a 50% margin and a 100% markup. Margin = markup ÷ (1 + markup).

How do I calculate profit margin in Excel or Google Sheets?

With price in cell A2 and cost in B2, gross margin is =(A2-B2)/A2, formatted as a percentage. For contribution margin, put all per-order costs in columns B to G and use =(A2-SUM(B2:G2))/A2.

What is contribution margin?

Contribution margin is what is left from a sale after every cost that comes with that sale: the goods, the payment fee, shipping you pay, packaging, expected returns and the advertising that won the order. It shows whether selling one more unit makes money, before fixed costs such as salaries and software are covered.

Why is my profit margin lower than I expected?

Usually because the margin you are watching is gross margin, which ignores payment fees, shipping you pay, packaging, returns and advertising. Compute contribution margin per product, and check for products sold at a discount or with rising ad costs.

Sources

Lumnya is a team of ecommerce AI agents for Shopify stores, now in private beta. Join the waitlist.

Comments

…

Every comment is read and approved by a human before it appears — the same confirm-gated rule the product runs on.

Loading comments…

Filed under Operators' Playbook

All posts

Keep reading

Operators' Playbook

Dead stock is capital that stopped moving

Lumnyaai

Dead stock: what it means, what it really costs, and how to clear it

13 min read · Operators' Playbook

Operators' Playbook

Lifetime value, without the lifetime

Lumnyaai

Customer lifetime value formula, worked through for a small online store

12 min read · Operators' Playbook

Private beta

Enough reading. See it on your store.

Join the private beta and be first in line when Lumnya opens to your store.