Gross margin is the share of your selling price left after you pay for the product itself. Take the price, subtract the cost of goods, and divide by the price. A $60 product that costs $18 to make or buy has a 70% gross margin, which means 70 cents of every dollar is gross profit before any other cost touches it.

For a Shopify store, gross margin is the first number we check on any product, because every other cost in the business gets paid out of it. Shipping, payment fees, discounts, ads, apps and salaries all come from that 70 cents. If it's thin, nothing downstream can fix it.

How to calculate gross margin

The formula has three terms:

Gross margin % = (selling price − cost of goods) ÷ selling price × 100

  • Selling price is what the customer pays for one unit, before shipping charges and tax. Use the price customers actually pay, not the compare-at price.
  • Cost of goods is what one unit costs you to make or buy. Include the landed cost: the product, inbound freight to your warehouse, duties and any packaging that ships with every unit.
  • Gross profit is the gap between the two (price minus cost). The calculator shows it as a dollar figure per unit.

The calculator also returns markup, which uses the same gross profit but divides it by the cost instead of the price:

Markup % = (selling price − cost of goods) ÷ cost of goods × 100

Gross margin worked example

These are the calculator's default inputs. Change them to your own numbers above.

Input or resultValue
Selling price$60
Cost of goods$18
Gross profit per unit$60 − $18 = $42
Gross margin$42 ÷ $60 = 70%
Markup$42 ÷ $18 = 233.3%

The same $42 of profit reads as 70% or 233.3%, depending on which number you divide by. Neither is wrong. They answer different questions, which is the source of most pricing confusion.

Gross margin vs markup: which one should you use?

Gross margin answers "how much of each sale do I keep?" Markup answers "how much did I add on top of my cost?" Margin is measured against the price, markup against the cost.

Use markup when you're setting a price from a cost: you know the product costs $18 and you want to add a fixed percentage on top. Use gross margin for everything after that: comparing products, planning discounts, setting ad budgets and reading your Shopify reports. Your profit and loss statement is built on revenue, so margin lines up with it and markup doesn't.

The mistake to avoid is mixing them. A supplier quoting "100% markup" is describing a 50% margin, not a 100% one. If you need to go from a cost and a markup to a price, use the markup calculator, which includes a conversion table.

Gross margin vs contribution margin

Gross margin stops at the product. Contribution margin keeps going and subtracts every cost that scales with an order: shipping and fulfilment, payment processing fees and discounts. It's the money one order contributes towards your fixed costs and profit.

Here's why the difference matters. A 70% gross margin feels comfortable. But on a $60 order with $10 shipping, a 3% payment fee and a $4 discount, the same product contributes $26.20, or 43.7% of the order. That's the number that decides what you can afford to pay for a customer.

We use gross margin to judge a product and contribution margin to judge an order. Run your order-level numbers through the contribution margin calculator, and read our guide to contribution margin in ecommerce for how to use it in pricing and ad decisions.

How to read your gross margin result

Your result is only useful against your own costs, so read it with these rules:

  • Compare it to your per-order costs. Add your shipping, fees and average discount per order, then divide by your price. If that share is close to your gross margin, each order contributes almost nothing, whatever the margin looks like on its own.
  • Compare products against each other. Sort your catalogue by gross margin. Products at the bottom of your own range are the first candidates for a price change, a cost renegotiation or a smaller ad budget.
  • Check it against your discount depth. A 20% off code comes straight out of gross margin, not out of the price you started from. Run the calculator again at the discounted price to see what you really keep.
  • Watch the trend, not one reading. Rising supplier costs move gross margin down quietly. Recalculate when a cost changes, not once a year.

What moves gross margin

There are only two inputs, so there are only two directions: raise the price or lower the cost. In practice that breaks into a few levers.

  1. Price. A price rise flows almost entirely into gross profit. It's often the fastest lever, but test it, because conversion rate can move too. Our ecommerce pricing strategy guide covers how to raise prices without guessing.
  2. Landed cost. Renegotiate unit costs at higher volumes, consolidate inbound shipments and review duties. A dollar saved on cost of goods is a dollar of gross profit.
  3. Discount habits. Frequent site-wide sales train customers to wait, and every sale lowers your effective price. Track the average price customers actually pay, not your list price.
  4. Product mix. If your highest-margin products sit deep in the catalogue, promoting them raises store-wide gross margin without changing a single price. Our Teardown looks at how your store presents its range.

Common gross margin mistakes

  • Using the wrong cost. Factory price alone understates cost. Freight, duties and packaging belong in cost of goods.
  • Dividing by cost instead of price. That gives you markup. If your "margin" is over 100%, you've calculated markup.
  • Ignoring discounts. Gross margin at full price is a best case. Calculate it at the price customers actually pay.
  • Stopping at gross margin. A healthy gross margin can still hide orders that lose money after shipping and fees. Check contribution margin before you set an ad budget.
  • Averaging across very different products. A store-wide figure can hide one bestseller that barely breaks even. Calculate per product first.

Where to go next

Gross margin is the starting point. To see what a whole month looks like after ads, apps and fixed costs, try the Shopify profit calculator, or browse all our ecommerce calculators. If you'd rather we looked at the store itself, the Teardown reviews your homepage, best-selling product page and cart drawer, with every finding ranked by what to fix first.