All Tools

Gross Profit and Gross Margin Calculator

Work out gross profit, gross margin, markup and COGS as a share of sales, for a whole period of store sales or for a single product.

What is gross profit?

Gross profit is what is left of your net sales after paying for the goods you sold: net sales minus cost of goods sold (COGS). Gross margin is gross profit as a percentage of net sales. Both come before shipping, payment fees, ad spend and overheads, which is why gross profit is not net profit.

Sales in, cost of goods out

Choose a period of sales or a single product. Enter every amount in the same currency and leave sales tax out of your sales figures.

What are you calculating?

Sales

Gross sales for the period, before returns and discounts.

Enter sales as

Returns and discounts

Optional. Both come off gross sales to give net sales.

Cost of goods sold

What the goods behind those sales cost you.

The formula

Gross profit formula: how to calculate gross profit and gross margin

Net sales = Gross sales - Returns - Discounts; Gross profit = Net sales - COGS; Gross margin % = Gross profit / Net sales x 100

Take returns and discounts off first, then the cost of the goods. Gross margin is the same gross profit expressed as a share of net sales.

Gross sales
Everything customers were charged for goods in the period, before returns and discounts, excluding sales tax. In units mode: units sold x average selling price.
Returns
Money refunded to customers for returned or cancelled goods.
Discounts
Discount codes, markdowns and promotions taken off the price.
Net sales
The revenue you actually kept from selling goods.
COGS
Cost of goods sold: what the goods you sold cost to buy or make and get ready to sell.
Markup
Gross profit / COGS x 100. The same profit as gross margin, divided by cost instead of by net sales.
COGS % of net sales
COGS / Net sales x 100. Always equal to 100% minus gross margin.
  • A returned item you put back into stock is not a cost of goods sold. If your COGS figure still includes it, take its cost out, or gross profit will be understated.
  • In single-product mode there are no returns or discounts, so net sales is the selling price and the result is the product's gross margin at full price.

Worked examples

Three gross profit calculations, worked through

Each example follows the same steps as the calculator. The numbers are made up to show the arithmetic, not taken from a real store, and the amounts are in any one currency.

Example 1

One product at full price

A candle sells for 60.00. Buying it, including the jar and the inbound freight, costs 21.00 per unit.

Inputs

Selling price
60.00
Unit cost (COGS)
21.00

Working

  1. Gross profit: 60.00 - 21.00 = 39.00 per unit
  2. Gross margin: 39.00 / 60.00 = 65.0%
  3. Markup: 39.00 / 21.00 = 185.7%
  4. COGS share: 21.00 / 60.00 = 35.0%, and 65.0% + 35.0% = 100%

Gross margin

65.0% (39.00 per unit)

The 39.00 is what each sale leaves to pay for shipping, payment fees, ads and overheads. When you compare products at different prices, compare their gross margins rather than the amounts, because every other cost of a sale is a share of the price.

Example 2

A month of sales with returns and discounts

A store sells 1,200 units at an average of 25.00 in a month. It gives 1,800 in discount codes, refunds 1,200 on returned orders, and the goods behind the sales it kept cost 11,610.

Inputs

Units sold
1,200
Average selling price
25.00
Returns and refunds
1,200
Discounts
1,800
Cost of goods sold
11,610

Working

  1. Gross sales: 1,200 x 25.00 = 30,000
  2. Net sales: 30,000 - 1,200 - 1,800 = 27,000
  3. Gross profit: 27,000 - 11,610 = 15,390
  4. Gross margin: 15,390 / 27,000 = 57.0%
  5. COGS share: 11,610 / 27,000 = 43.0%; markup: 15,390 / 11,610 = 132.6%

Gross margin

57.0% (15,390 gross profit)

Working from gross sales instead would give (30,000 - 11,610) / 30,000 = 61.3%, a margin 4.3 points higher than the store really earned. Returns and discounts are revenue you never kept, so take them off first.

Example 3

The same product after a supplier price rise

The supplier raises the candle's unit cost from 21.00 to 25.20, and the selling price stays at 60.00.

Inputs

Selling price
60.00
New unit cost (COGS)
25.20

Working

  1. Gross profit: 60.00 - 25.20 = 34.80 per unit, down from 39.00
  2. Gross margin: 34.80 / 60.00 = 58.0%, down from 65.0%
  3. Markup: 34.80 / 25.20 = 138.1%
  4. Price that brings the margin back to 65.0%: 25.20 / (1 - 0.65) = 72.00

Gross margin

58.0% at 60.00, or 65.0% at 72.00

A 4.20 rise in cost takes 7 points off gross margin. Getting the margin back takes a 12.00 price rise, not 4.20, because the margin is a share of the price.

Beyond gross profit

Gross profit vs net profit

Gross profit only takes off what the goods cost. For an online store a lot sits between that line and the money you actually keep, and most of it grows with every order.

Shipping and fulfilment

Postage, packaging and any 3PL pick-and-pack charge to get each order to the customer, minus what the customer paid you for shipping.

Payment fees

The percentage and fixed fee your payment provider takes on every order, plus any transaction fee your store platform adds.

Ad spend

What you paid Meta, Google, TikTok and other channels to win the orders. For a store that grows through paid ads it can take a large share of gross profit.

Overheads

Software and platform subscriptions, staff, rent, insurance and other costs that do not change with each order.

Net profit is what is left after all four, and it can be negative while gross margin looks healthy. To follow one order down to net profit, use the Shopify Profit Margin Calculator. To lay out a whole month, use the Ecommerce P&L Builder.

What counts as cost of goods sold for an online store

COGS is the cost of getting the goods you sold ready to sell. Where the line falls is partly an accounting choice, so agree it with your accountant and apply the same rule every month, or gross margin will move for reasons that have nothing to do with the business.

Usually in COGS

  • The purchase or manufacturing cost of each unit
  • Inbound freight to get stock to your warehouse
  • Import duty, customs fees and brokerage
  • Packaging that is part of the product itself

Usually below gross profit

  • Shipping orders out to customers
  • Payment processing and platform fees
  • Advertising and marketing
  • Rent, software, salaries and other overheads

To build a per-unit cost from your supplier invoices, use the COGS Calculator. If you import stock, the Landed Cost Calculator adds freight, duty and fees to each unit.

In MerchantFlow

Gross profit on every product, every day

MerchantFlow connects to your Shopify or WooCommerce store, takes each product's cost from your COGS records, nets out refunds and discounts, and shows gross profit by product and by day. Your P&L then carries on through shipping, payment fees, ad spend and expenses to net profit.

See COGS management

Common Questions

Gross profit and gross margin: FAQ

What is the difference between gross profit and gross margin?

One is an amount of money, the other a percentage. Use gross profit when the question is how much you have to spend: it is the pool that shipping, payment fees, ads and overheads come out of. Use gross margin when you compare things of different sizes, such as two products at different prices, this month against last, or your store against a plan, because it does not grow just because sales did.

Is gross margin the same as markup?

No. Both start from gross profit, but gross margin divides it by net sales and markup divides it by the cost of the goods. For a profitable product markup is always the larger number, so a 50% markup is not a 50% margin. This calculator shows both side by side, and the Markup Calculator works the other way, from cost to price.

What is a good gross profit margin?

There is no gross margin that is right for every store. It depends on what you sell, how you ship it and how you win customers. Work it out from your own numbers instead: add up everything that comes off after gross profit (shipping, payment fees, ad spend and overheads) as a share of net sales, then add the net margin you want to keep. Your gross margin needs to be at least that total.

Should shipping be included in cost of goods sold?

Freight to bring stock in from a supplier usually is, because it is part of what the goods cost you. Shipping orders out to customers usually is not: it is often treated as a fulfilment cost below gross profit. Either choice can be defended, so pick one, apply it every month and compare like with like.

How do I handle partial refunds and discounts on a single item?

Take off only the money you actually gave back. A partial refund, such as a goodwill credit where the customer keeps the item, comes off gross sales in full, but the goods were still sold, so their cost stays in COGS. A discount on one line of an order counts the same as an order-wide code: add both into the Discounts total for the period.

Can gross margin be negative or above 100%?

It can be negative: if the goods cost more than they sold for, gross profit and gross margin are both below zero before a single other cost is counted. It cannot go above 100%, and it only reaches 100% when the goods cost nothing. Markup has no upper limit.

Is gross profit the same as revenue?

No. Revenue, or net sales, is what customers paid you after returns and discounts. Gross profit is what is left of it once the goods themselves are paid for. Revenue can grow while gross profit stays flat if the extra sales come with bigger discounts or higher product costs.