Skip to content

Gross Margin Formula, With a Free Calculator

The gross margin formula: sales minus cost of goods sold, over sales; what goes in the cost, a granola maker's year by product line, and a free calculator.

By Koa Sterling. Product specialist at TaroStack and small business owner. Yes, I am a real human, and I actually sit in front of a computer and write these articles. Reviewed October 16, 2026 · 7 min read

Gross profit = sales − cost of goods sold. Gross margin = gross profit ÷ sales. Cost of goods sold is what went into the things you sold: materials, packaging and the labor that made them. A granola maker that sells $191,100 in a year, of goods that cost $99,600 to make, has a gross profit of $91,500 and a gross margin of 47.9%: out of every dollar of sales, about 48 cents is left to pay the rent, the fees, the marketing and the owner. Below is each formula, what goes in the cost and what doesn't, the year by product line, the mistake that makes a month look terrible, and a free calculator.

The short version

  • Gross profit = sales − cost of goods sold, in dollars.
  • Gross margin = gross profit ÷ sales, as a percentage of the price.
  • Cost of goods sold is what went into the units sold, not what you bought this month.
  • Work it by product line and channel: the total hides a 30-point spread.
  • Markup is gross profit ÷ cost; a 47.9% margin is a 91.9% markup.
  • TaroStack costs every batch and shows margins by product and by customer. More below.

The formulas

To find Formula The granola maker's year
Gross profit Sales − cost of goods sold $191,100 − $99,600 = $91,500
Gross margin Gross profit ÷ sales $91,500 ÷ $191,100 = 47.9%
Markup Gross profit ÷ cost of goods sold $91,500 ÷ $99,600 = 91.9%
Price for a target margin Cost ÷ (1 − target margin) $3.30 ÷ (1 − 0.5) = $6.60

Margin is a share of the price; markup is a share of the cost, which is why the same bag has a bigger markup than margin. How to turn one into the other is in markup vs margin.

What goes in the cost of goods sold

In cost of goods sold After gross profit
Oats, nuts, honey, oil and fruit Kitchen rent
Bags, labels and the cases they ship in Card and marketplace fees
The labor that mixes, bakes and bags Market stall fees and ads
Freight on the ingredients coming in The owner's own salary, if not paid as labor

Some makers put the kitchen's rent and power in cost of goods sold too, as production overhead. Either way works, if you keep to one, so one year compares with the next. How a bakery works out its cost of goods sold for the books is in how to calculate COGS for a bakery.

An example: a granola maker's year

Cache Valley Granola Co., a made-up granola maker in Logan, Utah, I use in these examples, sells 12-ounce bags at markets and online, the same bags to shops, 25-pound bulk bags to cafés, and granola bars to shops:

Product line Units Price Sales Cost a unit Cost of goods sold Gross profit Gross margin
Granola, 12 oz, markets and online 6,000 $9.00 $54,000 $3.30 $19,800 $34,200 63.3%
Granola, 12 oz, to shops 14,000 $5.40 $75,600 $3.30 $46,200 $29,400 38.9%
Granola, 25 lb bulk, to cafés 300 $95.00 $28,500 $64.00 $19,200 $9,300 32.6%
Granola bars, to shops 12,000 $2.75 $33,000 $1.20 $14,400 $18,600 56.4%
The year $191,100 $99,600 $91,500 47.9%

A 12-ounce bag costs $3.30: $2.40 of granola, bag and label, and 90 cents of labor. The same bag makes 63.3% at a market and 38.9% at a shop, and the shops are the biggest line. That's not a mistake: a shop selling the bag at $9 needs to buy it at about $5.40 to keep its own 40%, and pricing the bag to the maker's 50% target, $6.60, would leave the shop 27%. Where the shop's margin and the maker's meet is in distributor margin.

So the mix moves the total. If next year brings 4,000 more shop bags, gross profit rises $8,400 to $99,900, and gross margin falls from 47.9% to 47.0%, because the new sales are the lower-margin kind. A falling gross margin isn't always bad news; a falling gross profit is.

The mistake that makes a month look terrible

In October, the granola maker sells $19,800 and spends $14,000 on oats, nuts and bags for the holiday run, plus $2,200 of labor. Subtract what was spent and the month's "margin" is 18%. But most of what was bought is still on the shelf as stock. The goods actually sold in October cost $10,300, so the gross profit is $9,500 and the gross margin 48.0%, in line with the year. Cost of goods sold is the cost of what left, not of what came in; what was bought and not sold stays in inventory until it sells.

What a good gross margin is

Enough to pay everything that comes after it and leave a profit. A maker with $5,000 a month of rent, fees and marketing on $16,000 a month of sales needs more than 31% to break even, and more to pay the owner. In the example, direct sales run above 60% and sales to shops below 40%, so a maker's mix of channels sets most of its margin. What's typical for packaged food is in good profit margin for a food product, and how much of each sale is left to pay the fixed costs is in contribution margin example.

Get the calculator

Download the gross margin calculator. One line for each product line or channel: type the units sold, the price, and the materials, packaging and labor in each unit, and sales, cost of goods sold, gross profit, gross margin and markup fill in, with the year's totals at the side. Type a target margin, and each line shows the price that would reach it. It's an ordinary Excel file with no macros, and it works in Google Sheets, LibreOffice and Numbers.

Where this stops working

A cost a unit typed once goes stale. Almonds go up 20%, a batch burns, the new bags cost 4 cents more, and the $3.30 bag is now $3.55, while the sheet still says 38.9%. And a yearly total by product line can't say which shops' orders, at which discounts, pulled the margin down.

How TaroStack does it

TaroStack costs every batch and shows margins by product and by customer.

Batch costs from what you paid. Each batch of granola takes its oats, nuts and honey off stock at what they cost, with its labor minutes, so the cost of each bag comes from the batch it was made in. The actual cost sits beside the standard cost, so a batch that cost more than the recipe says stands out.

Margins where they're made. Margins are reported by product and by customer, so the café with the bulk discount and the shop that pays full wholesale each show their own gross margin.

Price creep. A report shows which ingredients' prices have crept up, so the almonds' 20% shows before it's eaten a year of margin. Why costs drift from the recipe is in food cost variance formula.

The job Spreadsheet In TaroStack
The cost of a bag Typed once From the batch it was made in
Margin by customer Not worked out Margins by customer
A batch that cost too much Unnoticed Actual cost beside standard
Ingredients going up Found at year end Price-creep report

Recipes, batch costing and margin reports are on every plan, from $49 a month. The first 30 days are free, with no credit card. If you'd like a hand setting up, ask, and we'll do it with you.

Questions people also ask

How do you calculate gross margin?

Subtract the cost of goods sold from sales, then divide by sales. In the example, ($191,100 − $99,600) ÷ $191,100 = 47.9%.

What is the difference between gross profit and gross margin?

Gross profit is in dollars, sales minus cost of goods sold: $91,500 in the example. Gross margin is the same thing as a share of sales: 47.9%.

Is gross margin the same as markup?

No. Margin divides the gross profit by the price; markup divides it by the cost. A 47.9% margin is a 91.9% markup.

Does gross margin include labor?

The labor that makes the product goes in cost of goods sold, so it comes off before gross profit. Office work, selling and the owner's salary, if not paid as production labor, come after.

We use AI to help with the research for these articles. Every one is read, checked against its sources and edited by Koa before it's published. Spot a mistake? Tell us and we'll fix it and say so. How we write these.

Let’s get your stack in order.

Get TaroStack

Sign up now for your free 30 day trial. No credit card required.