How to Calculate Profit Margin (Formula + Examples)
Profit margin is the single number that tells you whether your business is healthy. It is also the number most small business owners cannot calculate without pausing to look it up, because everyone learns it once in a freshman accounting class and then never sees it again until tax season. The good news is that the math is two steps and a divide button. By the time you finish this post you will know the one-line formula, the three flavors of profit margin (gross, operating, net) and which one to reach for in which conversation, how to drop the calculation into Excel or Google Sheets without botching the percentage formatting, and what counts as a "good" margin for your kind of business. The example throughout is a coffee shop selling a $5 latte — concrete enough to follow, generic enough to map onto a SaaS subscription, a Shopify SKU, or a freelance invoice.
The profit margin formula
Profit Margin = (Revenue − Cost) ÷ Revenue × 100In plain English: what percentage of every dollar you sell becomes profit? Subtract what it cost you from what you charged, divide that profit by the revenue, multiply by 100 to turn the decimal into a percentage. Every other version of profit margin you will ever see — gross, operating, net, contribution — is the same formula with a different definition of "cost." Master this one and the rest follow.
Step-by-step: calculating profit margin
The cleanest way to internalize the formula is on a single sale. Picture a coffee shop selling a $5 latte. The cost of the espresso beans, the milk, the cup, and the lid comes to $1.40 per drink. There are two steps from here to the margin percentage.
Step 1 — Find the profit. Subtract cost from revenue: $5.00 − $1.40 = $3.60. That is the gross profit on every latte the shop pours.
Step 2 — Divide profit by revenue, then multiply by 100. $3.60 ÷ $5.00 = 0.72. Multiply by 100 and you get a gross margin of 72% on the latte. Seventy-two cents of every dollar the customer hands over stays in the till before any of the day’s other costs touch it.
Most of the time you will not be running this math on a single drink — you will be running it on a month of receipts. The formula is identical, you just substitute period totals. Say the same shop runs $25,000 in revenue for the month against $9,400 in cost of goods sold (beans, milk, cups, syrups, pastries pulled from the case). Profit = $25,000 − $9,400 = $15,600. Margin = $15,600 ÷ $25,000 × 100 = 62.4% gross margin for the month.
Notice the gap. The single-drink calculation said 72%, the monthly calculation said 62.4% — roughly ten points lower. That gap is real and expected. The per-drink number is a best-case unit economic. The monthly number absorbs everything the per-drink math ignores: shots pulled and dumped, comps and remakes, the cookie that went stale, the cold brew batch that did not sell before it had to be tossed. The lesson is that a margin number is only as honest as the cost figure that feeds it. Pull both numbers from the same period and the percentage will tell you the truth.
Three types of profit margin (and when to use each)
Once you understand the base formula, the three commonly reported margins are just three different definitions of "cost" plugged into the same equation. The same coffee shop produces three different margins from the same month of revenue — each one answers a different question.
Gross profit margin
Gross Margin = (Revenue − COGS) ÷ Revenue × 100Cost of goods sold is the direct cost of producing what you sold — ingredients for the latte, hosting for the SaaS account, materials and labor for the deck you built. Use gross margin to evaluate whether your unit economics work. If gross margin is thin or negative, every additional sale loses money before you have even paid rent. The coffee shop’s gross margin for the month landed at 62.4%, which is healthy for a beverage-led cafe.
Operating profit margin
Operating Margin = Operating Income ÷ Revenue × 100Operating income is what is left after you subtract everything it takes to run the business day to day — rent, payroll, utilities, software, marketing, insurance — but before interest and taxes. Use operating margin to evaluate whether the actual day-to-day business is profitable. The coffee shop’s 62.4% gross margin compresses to roughly 22% operating margin once rent, baristas, point-of-sale fees, and the espresso machine lease come out. That is the number to watch month over month.
Net profit margin
Net Margin = Net Income ÷ Revenue × 100Net income is what is left after everything — operating expenses, interest on any business loan, and income tax. Use net margin to evaluate the whole business. The coffee shop’s 22% operating margin lands at roughly 14% net margin after tax. That 14% is the real cash the owner can take as a salary, reinvest in the shop, or set aside as reserves.
Which one matters depends on the decision you are making. Pricing a new menu item? Gross margin. Deciding whether to hire another barista? Operating margin. Telling a lender how the business is doing? Net margin. Three numbers, one formula, three different answers — all of them correct for their purpose.
How to calculate profit margin in Excel or Google Sheets
For a single product or month, mental math is fine. For a catalog or a P&L, drop the formula into a spreadsheet and let the columns do the work. Put cost in column A and revenue in column B. In column C type the margin formula:
=(B2−A2)/B2That gives you the margin as a decimal (0.72 for the latte). Highlight column C, hit the % button on the toolbar, and the cell will display 72.00% — Excel and Sheets both multiply by 100 automatically when you apply the Percentage format. Do not multiply by 100 inside the formula and format the cell as Percentage; that combination turns 72% into 7,200%. Either write =(B2−A2)/B2 and format as Percentage (recommended), or write =(B2−A2)/B2*100 and leave the format as Number.
| Product | Cost (A) | Revenue (B) | Profit | Margin % |
|---|---|---|---|---|
| Latte | $1.40 | $5.00 | $3.60 | 72.00% |
| Drip coffee | $0.55 | $3.50 | $2.95 | 84.29% |
| Croissant | $1.20 | $4.50 | $3.30 | 73.33% |
| Bottled water | $0.45 | $3.00 | $2.55 | 85.00% |
A common mistake at this stage is sorting by margin and assuming the highest-margin product is the most profitable. It is not. Margin is a ratio. A bottled water at 85% margin still only contributes $2.55 in profit per sale, while a $30 catering platter at 50% margin contributes $15. To rank products by actual dollars earned, sort by the Profit column, not the Margin column. Use margin for pricing decisions, profit dollars for product-mix decisions.
What's a good profit margin?
The fast answer: across most industries, a 10% net profit margin is healthy, 20%+ is excellent, and under 5% is a warning sign. But the meaningful answer depends entirely on the kind of business. Software companies typically run 70%+ gross margins because once the code is written, an additional subscription costs almost nothing to deliver. E-commerce stores run 40–50% gross and 5–10% net after shipping, returns, and ad spend. Restaurants live on 60–70% gross margin and finish at 3–5% net once rent and labor have eaten everything. None of those numbers is "good" or "bad" on its own — they are good or bad relative to similar businesses.
The right benchmark is your industry, not the all-industry average. If you want a deeper look at margin ranges across twelve common industries, the sister post What is a good profit margin? walks through each one with 2026 data. The short version: target the upper third of your category, not the all-industry mean.
Common mistakes to avoid
Four mistakes account for almost every wrong margin number you will encounter in the wild. Each one is preventable with thirty seconds of attention.
- Confusing margin with markup. Markup divides profit by cost; margin divides profit by revenue. A 50% markup is a 33.33% margin — the percentages are never equal on a profitable sale. Vendors and pricing playbooks talk in markup, accountants and income statements talk in margin. The full breakdown lives in markup vs margin.
- Mismatching periods. Do not compare January revenue against February costs, or holiday-quarter sales against off-season expenses. Pull both numbers from the same window or the percentage will mislead you. Same store, same month, every time.
- Forgetting hidden costs. Payment processing alone is roughly 2.9% + $0.30 per Stripe transaction, plus shipping, returns, refunds, chargebacks, and inventory shrinkage. These rarely show up on the obvious cost line, but they all eat margin. The fix is to maintain a "true cost" of each unit that includes the fees and adjustments — not just the supplier invoice.
- Only tracking gross margin. Gross margin looks great right up until rent, payroll, software, and tax arrive. Net margin is the number that funds your salary, your growth, and your cash reserves. If you only watch one margin number, watch net — and if you watch gross to manage pricing, watch net to manage the business.
Quick reference
Calculate your own margin
Take your last month of sales and your last month of cost of goods sold, drop them into the profit margin calculator, and you will have your gross margin in under thirty seconds. The calculator also shows the equivalent markup, the gross profit in dollars, and the cost ratio side by side, so you can see all four perspectives at once. From there, the markup calculator handles the pricing side and the break-even calculator tells you how many units you need to sell at that margin to cover your fixed costs.