Gross margin: what it is and how to calculate it

Gross margin is what's left of the price after you pay for the product. Here's how to calculate it, what it's for, and why it's not enough to make decisions in your e-commerce business.

Francisco Brienza

· 7 min read

Gross margin = (price − product cost) ÷ price. Example: $48.000 ÷ $80.000 = 60%
In this article

Gross margin is the part of the price you keep after paying for the product. To calculate it, subtract what it cost you to buy or make what you sold from the price, then divide by the price.

It's the first number you use to set prices and choose which products to push. What it doesn't do is deduct bank and platform fees, card installment fees, shipping, or taxes, and that's why it's not enough to make advertising decisions.

The result: your sneakers seem to leave you 60% of every sale, when after all costs they actually leave you 27%.

Summary

  • Gross margin = (price − product cost) ÷ price.
  • It's useful for setting prices, comparing products, and negotiating with your suppliers.
  • It's not enough to decide how much to spend on advertising, because it doesn't deduct taxes, fees, or shipping. We explain why below.

How do you calculate gross margin?

Gross margin = (sale price − product cost) ÷ sale price

  • Sale price: what the customer pays for the product.
  • Product cost: what it cost you to buy it from your supplier or to make it.

You can calculate it product by product or for the whole month: in that case, it's what you sold minus what everything you sold cost you, divided by what you sold.

Example: gross margin for a VTEX store

A sporting goods store on VTEX compares three of its products:

Product Price Product cost Gross margin
Sneakers $80.000 $32.000 60%
T-shirt $20.000 $6.000 70%
Ball $15.000 $9.000 40%

The T-shirt leaves the most for every peso it sells, and the ball the least.

What is gross margin used for?

It's the number that tells you fastest how your pricing is set up. It's useful for four things:

  • Setting prices. If you know the gross margin you want, you know what to sell for: with a cost of $32.000 and a 60% margin, the price is $80.000.
  • Choosing which products to push. In the example, the T-shirt leaves 70 cents of every peso it sells and the ball, 40: if you can feature one in your store or in a bundle, go with the T-shirt.
  • Negotiating with your supplier. If the cost of the sneakers drops to $28.000, gross margin goes up from 60% to 65%.
  • Seeing whether inflation is eating your margin. If costs go up and prices don't, gross margin drops month after month. It's the first warning sign that you need to update your prices.

How is it different from contribution margin and net margin?

Gross margin Contribution margin Net margin
Subtracts from the price Only the product cost All variable costs Variable costs, advertising, and fixed costs
For the sneakers 60% 27% Depends on your advertising and fixed costs
What it's for Comparing products Deciding how much you can spend on advertising Knowing whether the business makes money

All three are called "margin," and that's why people mix them up. Gross is the highest of the three and the easiest to calculate: it's the starting point for the other two.

What is a good gross margin?

One that leaves you room to pay for everything that comes after: taxes, fees, shipping, and advertising. For the sneakers in the example, that eats up 33 of the 60 points:

% of price
Gross margin 60%
VAT on the sale (21%) −17.4%
Card fee for 3 installments (example: 7%) −7%
VTEX fee (example: 2.5%) −2.5%
Shipping you absorb −5%
Packaging −1%
Contribution margin 27.1%

With a 40% gross margin, like the ball's, there's almost nothing left for advertising after those costs. That's why the higher your gross margin, the more room you have for everything that comes after.

Why isn't gross margin enough to make decisions?

Because it isn't built for that: it leaves out half the costs of each sale. And on top of that, the ROAS you compare it against is inflated. There are three reasons.

1. It doesn't deduct what it costs to sell. With the sneakers' gross margin, your break-even ROAS comes out to 1 ÷ 0.60 = 1.67x. With contribution margin, it's 1 ÷ 0.271 = 3.69x. A campaign with a 3x ROAS looks like it's winning comfortably, when in reality it loses money on every sale. We explain this in Break-even ROAS.

2. They both claim the same sale. If someone saw your ad on Instagram without clicking and then bought through Google, both Meta and Google claim that sale. There was one sale; the reports show two.

That 3x campaign that was already losing money shows up as 4.7x in Meta's report. Put gross margin and Meta's ROAS together and the error doubles. We explain this in The same sale, counted three times.

3. They're missing data. With iOS, ad blockers, and device switching, sometimes the pixel doesn't see a purchase and Meta fills it in with estimates.

How do you know how much each product really leaves you?

By connecting your store and your ad accounts to Elykia. It works with Tiendanube, Shopify, VTEX, WooCommerce, and more.

It matches each sale with what it cost you: the product, shipping, the fees for each payment method, and taxes. It also reconstructs each customer's journey, click by click, and counts each sale only once, even if it went through both Meta and Google.

With that, you get the gross margin and contribution margin for each product, and the profit each channel, campaign, and ad leaves you after paying for advertising. And all in the same place: how much each customer leaves you including repeat purchases, the journey behind each purchase, and the ability to ask Claude about all of it.

What you get with Elykia:

  • Sell more while spending less. You put your advertising behind the products that actually leave you profit, not the ones that only look like they do.
  • Scale without fear. Before raising your budget, you know how much each sale leaves you after all costs.
  • Get Meta to bring you better customers. You send back the sales Elykia tracks, and its algorithm learns from people who buy, not from clicks.

Frequently asked questions

Gross margin or contribution margin?

Both, for different things. Gross margin is for comparing products and seeing how much what you sell costs you. Contribution margin is the one you need to use to make advertising decisions, because it deducts everything it costs to sell.

How do I raise my gross margin?

The four most common levers are: raising prices, negotiating costs with your supplier, buying in larger quantities to pay less per unit, and pushing the products that leave you the most margin.

Do you calculate it per product or per month?

Both ways work. Per product tells you which ones are the best for you; per month tells you how much, on average, everything you sold leaves you. If the average drops, check whether you're selling more of your lower-margin products.

Join the Elykia Newsletter

Science applied to marketing: in-house studies, market benchmarks, Claude skills and the latest from Meta and Google.

No spam, promise.