virling Pricing Self-host Demo Changelog Agencies GitHub Start free trial
tools / gross margin calculator

Gross margin calculator

Enter your revenue and cost of goods to get gross profit, gross margin and markup. Add payment fees and shipping if you count them as cost of sales. Works for one product, one order or a whole month of a store or SaaS business. Everything runs in your browser.

Revenue is what buyers paid without sales tax, after discounts and refunds. Set payment fees and shipping to 0 to get gross margin on product cost alone.

A store-wide margin hides which channels bring your high-margin sales. Virling links every visit to the payment it led to, so you see the revenue and orders each channel brings from your real payments, and its Profit by channel card takes your spend and payment fees off each one. 14 days free.

Start free trial

Related: contribution margin calculator, payment fee calculator, break-even CPA calculator, LTV calculator, break-even point calculator, markup calculator.

The gross margin formula

Gross profit is what is left of revenue after the direct cost of what you sold. Gross margin is that profit as a share of revenue, and markup is the same profit as a share of cost:

cost of sales = cost of goods + payment fees + shipping

gross profit = revenue - cost of sales

gross margin % = gross profit / revenue

markup % = gross profit / cost of sales

Gross margin leaves out rent, salaries, software and marketing. To take off acquisition cost and see what one order adds to profit, use the contribution margin calculator.

A worked example

These are round illustrative numbers, the same ones the calculator starts with, not data from a real store. A store takes $10,000 of revenue in a month. The products it sold cost $4,000, payment fees were $300 and shipping cost $700. Cost of sales is $5,000, so gross profit is $10,000 - $5,000 = $5,000. That is a 50% gross margin and a 100% markup.

Counting only the $4,000 of product cost, gross profit is $6,000: a 60% gross margin and a 150% markup. Neither number is wrong, but they are not comparable, so say which costs you include when you quote a margin.

Five examples side by side

Made-up examples, not benchmarks, worked out with the calculator's formulas. The first four number columns are what you enter, the last four are what it shows:

ExampleRevenueCost of goodsPayment feesShippingGross profitGross marginMarkupCost of sales
The defaults above$10,000$4,000$300$700$5,000.0050%100%$5,000.00
Product cost only$10,000$4,000$0$0$6,000.0060%150%$4,000.00
Same goods, 20% off$8,000$4,000$240$700$3,060.0038.3%61.9%$4,940.00
One $50 order$50$20$1.75$6$22.2544.5%80.2%$27.75
A SaaS month$20,000$3,000$880$0$16,120.0080.6%415.5%$3,880.00

The sale row moves the same goods for $2,000 less. Payment fees fall with the price, here at 3% of revenue, but the goods and the shipping cost the same, so gross profit drops by $1,940. The SaaS row has a high margin because serving one more customer costs little, and its markup shows how far apart the two numbers get as cost becomes small.

Gross margin by acquisition channel

Channels do not sell the same mix of products, and a cheap channel whose buyers pick low-margin items can earn less than it looks. Take two channels that each bring $5,000 of revenue, again with made-up numbers. Channel A costs $1,000 in ads, a 5x ROAS, but its orders carry a 30% gross margin: $1,500 of gross profit, or $500 after the ads. Channel B costs $2,000, only a 2.5x ROAS, but its orders carry a 70% margin: $3,500 of gross profit, or $1,500 after the ads. The channel with half the ROAS earns three times as much.

So judge a channel by the gross profit it brings, not its revenue. The break-even CPA calculator shows how much you can pay per customer at a given margin, the contribution margin calculator works it out per order, and LTV by acquisition channel covers the repeat purchases that come later.

Reading a channel's margin as a break-even ROAS

Enter one channel's revenue, goods, fees and shipping on their own to get its margin. Then turn that margin into the ROAS at which the channel's ads pay for themselves:

break-even ROAS = 1 / gross margin

Channel A, at 30%, breaks even at 3.33x, so its 5x is 1.5 times break-even. Channel B, at 70%, breaks even at 1.43x, so its 2.5x is 1.75 times break-even. A single store-wide target would cut the better channel. Use the margin of the orders each channel really brought, and the same costs in all of them.

Three mistakes with gross margin

  • Averaging the percentages. $9,000 of sales at 30% and $1,000 at 70% do not make 50%. Add up first: $2,700 + $700 is $3,400 of gross profit on $10,000, a 34% margin.
  • Leaving refunds in revenue. If $1,000 of the $10,000 was refunded and the goods cannot be sold again, revenue is $9,000 while the $5,000 cost of sales stays. The margin is 44.4%, not 50%.
  • Pricing with a markup when you meant a margin. A $20 product with a 50% markup sells for $30, which is a 33.3% margin. A 50% margin needs a price of $40, a 100% markup.
questions

Gross margin calculator FAQ

How do you calculate gross margin?

Subtract the cost of goods sold from revenue to get gross profit, then divide gross profit by revenue. $10,000 of revenue with $4,000 of cost of goods gives $6,000 of gross profit and a 60% gross margin.

What is the difference between gross margin and markup?

Both start from gross profit, but gross margin divides it by revenue and markup divides it by cost. A product that costs $40 and sells for $100 has a 60% gross margin and a 150% markup. Margin can never reach 100%; markup can be any size.

Should payment fees and shipping be in cost of goods?

It depends on how you report. Many stores count payment processing and outbound shipping as cost of sales, so they come off before gross profit; others put them lower down as operating costs. Pick one way and keep it, so your margin is comparable from month to month. The optional fields let you see both.

What counts as cost of goods for a SaaS company?

For software, cost of goods is usually the cost of serving customers: hosting, third-party services used per customer, payment fees and often customer support. Salaries for building the product, sales and marketing are normally left out.

Why does gross margin matter for marketing?

Gross profit is what pays for acquisition. A channel that brings orders on low-margin products leaves less gross profit per dollar of revenue, so it can earn less than a channel with a lower ROAS that sells higher-margin products.

How does a discount change gross margin?

A discount comes off revenue and leaves most of the cost in place. A $100 product that costs $40 has a 60% gross margin. At 20% off it sells for $80, gross profit falls from $60 to $40 and the margin to 50%. You would need to sell 50% more units to earn the same gross profit.

See which channels bring your margin

These tools estimate. Virling measures: it links every visit to the payment it led to, so you see the orders and revenue each channel brings from your real numbers. 14 days free.

Start free trial See the demo