Skip to main content
True MarginTrue Margin
How to Calculate Profit Margin (With Examples)
← Back to blog

How to Calculate Profit Margin (With Examples)

By Jack·March 10, 2026·10 min read

Profit margin = (Revenue - Cost) / Revenue x 100. That's the core formula. But "cost" means different things depending on which margin you're calculating — and using the wrong one is how founders convince themselves they're profitable when they're actually bleeding money.

This guide covers the three margin formulas that matter for ecommerce (gross, net, and contribution), walks through worked examples with real product numbers, and shows you the mistakes that make founders overestimate their margins by 10-20%.

The Three Profit Margin Formulas

There are three types of profit margin. Each answers a different question about your business:

Margin TypeFormulaWhat It Answers
Gross Profit Margin(Revenue - COGS) / Revenue x 100How much do I make on each product before expenses?
Net Profit Margin(Revenue - ALL Costs) / Revenue x 100How much do I actually keep after everything?
Contribution Margin(Revenue - Variable Costs) / Revenue x 100Does each sale contribute to covering fixed costs?

Gross margin is what you see on paper. Net margin is what hits your bank account. Most founders only track gross margin and wonder why their account balance doesn't match their spreadsheet.

1. Gross Profit Margin Formula

Gross profit margin measures what percentage of revenue is left after subtracting the direct cost of the product (COGS). It ignores marketing, shipping, fees, and overhead.

Formula: Gross Margin = (Revenue - COGS) / Revenue x 100

Worked Example: $50 Product

You sell a skincare serum for $50. It costs $15 to manufacture, package, and label.

  • Revenue = $50
  • COGS = $15
  • Gross profit = $50 - $15 = $35
  • Gross margin = $35 / $50 x 100 = 70%

That 70% looks great. But it doesn't account for the $10 you spent on Facebook Ads to acquire that customer, the $5 in shipping, or the $1.75 in payment processing fees. We'll get to those in the net margin section.

Worked Example: $25 Product (Dropshipping)

You sell a phone case for $25. Your supplier charges $8 per unit including fulfillment from China.

  • Revenue = $25
  • COGS = $8
  • Gross profit = $25 - $8 = $17
  • Gross margin = $17 / $25 x 100 = 68%

Solid gross margin. But dropshipping margins get destroyed by ad costs — if your CPA on Facebook Ads is $15 per purchase, you're netting $2 per sale before platform fees.

What COGS Includes

COGS should capture every cost directly tied to producing or acquiring the product:

  • Raw materials or wholesale purchase price
  • Manufacturing / production costs
  • Packaging and labeling
  • Inbound freight (getting the product to your warehouse)
  • Import duties and tariffs

COGS does NOT include marketing, outbound shipping to customers, platform fees, or overhead. Those go into the net margin calculation.

2. Net Profit Margin Formula

Net profit margin is the number that actually matters. It tells you what percentage of every dollar in revenue you get to keep after all costs are paid.

Formula: Net Margin = (Revenue - ALL Costs) / Revenue x 100

Worked Example: Full Unit Economics on a $50 Product

Same $50 skincare serum. Now let's add every real cost:

Cost CategoryAmount% of Revenue
Selling price$50.00100%
COGS (manufacturing + packaging)$15.0030%
Facebook Ads (CPA)$12.0024%
Shipping to customer$5.5011%
Payment processing (2.9% + $0.30)$1.753.5%
Shopify fees (Basic plan, prorated)$0.801.6%
Returns allowance (~5% of orders)$2.505%
Software & overhead (prorated)$1.503%
Total costs$39.0578.1%
Net profit per unit$10.9521.9%

The product went from a 70% gross margin to a 21.9% net margin. That's a 48-point gap — and this is a relatively healthy example. Many founders don't discover this gap until they look at their bank account and wonder where the money went.

This is why tracking net margin matters more than gross margin. If you want to see where your specific numbers land, plug them into our free profit margin calculator.

See your real margin — not your assumed one

Most founders overestimate profit margin by 10-20% because they forget hidden costs. Plug in your actual numbers and see what you really keep per order.

Open Profit Margin Calculator →

3. Contribution Margin Formula

Contribution margin tells you how much each unit sold "contributes" toward covering your fixed costs (rent, salaries, software subscriptions). It strips out variable costs but keeps fixed costs separate.

Formula: Contribution Margin = (Revenue - Variable Costs) / Revenue x 100

Variable costs are costs that change with each order: COGS, shipping per unit, payment processing per transaction, and per-order ad cost. Fixed costs are costs you pay regardless of sales volume: Shopify subscription, software tools, warehouse rent, salaries.

Worked Example: Contribution Margin

Using the same $50 product:

  • Revenue per unit = $50.00
  • COGS = $15.00
  • Shipping = $5.50
  • Payment processing = $1.75
  • Ad cost per acquisition = $12.00
  • Total variable costs = $34.25
  • Contribution margin = ($50 - $34.25) / $50 x 100 = 31.5%

That means each sale contributes $15.75 toward your fixed costs. If your monthly fixed costs are $5,000, you need to sell at least 318 units per month just to break even. Below that, you're losing money.

If contribution margin is negative, you lose money on every single order — and selling more only makes it worse. This is the number to watch when deciding whether a product is viable at scale.

Margin vs Markup: The Confusion That Costs Money

Margin and markup both describe profit, but they use different denominators. Confusing them leads to pricing errors that can tank your profitability.

  • Margin = profit as a % of selling price (revenue)
  • Markup = profit as a % of cost
CostSelling PriceProfitMarginMarkup
$10$20$1050%100%
$15$50$3570%233%
$20$50$3060%150%
$25$50$2550%100%
$30$50$2040%67%
$40$50$1020%25%

A 50% markup is NOT a 50% margin. If your product costs $20 and you apply a 50% markup, you sell it for $30. But your margin is only 33% ($10 / $30). This mistake is especially common with founders who come from a wholesale or retail background where markup language is standard.

When someone says "I need a 50% margin," that means the selling price needs to be 2x the cost. When someone says "I applied a 50% markup," the margin is only 33%. Same words, very different math.

Profit Margin by Industry

Margins vary dramatically by what you sell. Here are benchmarks from aggregated data across thousands of ecommerce stores. For deeper breakdowns, see our profit margin by industry report.

Industry / NicheAvg Gross MarginAvg Net Margin
Beauty & Skincare60-70%12-20%
Supplements & Wellness60-70%10-18%
Jewelry & Accessories60-75%10-20%
Fashion & Apparel50-60%5-13%
Food & Beverage50-60%5-10%
Pet Products50-60%8-15%
Home & Garden45-55%5-12%
Fitness & Sports40-55%5-12%
Consumer Electronics20-30%3-8%
Dropshipping (general)15-40%5-15%

Beauty and supplements consistently lead because manufacturing costs are low relative to perceived value. A serum that costs $3 to produce sells for $40-80. Electronics sit at the bottom because consumers compare prices aggressively and manufacturing costs are high.

If your gross margin is below 50%, scaling with paid ads becomes difficult. You need enough gross margin to absorb customer acquisition cost and still net a profit. Understanding your breakeven ROAS is critical here — it's a direct function of your margins.

How to Calculate Profit Margin: Step by Step

Here's the exact process to calculate your real profit margin — not the inflated version most spreadsheets show.

Step 1: Calculate Gross Margin

Start with your selling price and subtract COGS only. This gives you the baseline. If gross margin is below 50%, you may have a pricing problem or a sourcing problem before you even factor in other costs.

Step 2: List Every Variable Cost Per Order

Go through a real order and list every cost that occurs per transaction:

  • COGS (product cost)
  • Outbound shipping cost
  • Payment processing (Stripe/Shopify Payments: 2.9% + $0.30)
  • Transaction fees (if any, e.g., Shopify transaction fee on non-Shopify Payments)
  • Ad cost per acquisition (total ad spend / total orders)
  • Packaging materials (if not included in COGS)

Step 3: Prorate Fixed Costs

Divide your monthly fixed costs by your monthly order volume:

  • Shopify subscription / $39-399 per month
  • Software tools (Klaviyo, apps, analytics)
  • Warehouse or 3PL monthly minimums
  • Payroll (if any)
  • Returns allowance (average return rate x product cost + return shipping)

Step 4: Calculate True Net Margin

Add up Steps 2 and 3. Subtract from revenue. Divide by revenue. Multiply by 100. That's your actual net profit margin per order — the number that determines whether your business is truly profitable or just generating revenue.

Five Common Mistakes That Inflate Your Margin

Every one of these causes founders to think they're making more than they are:

  1. Forgetting payment processing fees. 2.9% + $0.30 per transaction doesn't sound like much, but on a $30 product that's $1.17 — nearly 4% of revenue gone before you've paid for anything else.
  2. Not accounting for returns. If your return rate is 10% (common in fashion), you need to bake that into every margin calculation. A $50 return costs you the product, outbound shipping, return shipping, and sometimes a restocking fee — easily $25-35 per return.
  3. Using markup when they mean margin. Saying "I have a 100% margin" when you actually applied a 100% markup. That's a 50% margin. See the table above.
  4. Excluding ad spend from the calculation. Your gross margin might be 70%, but if you're spending $15 in Facebook Ads CPA per order on a $50 product, your operating margin just dropped to 40% before all other costs.
  5. Ignoring platform and transaction fees. Shopify charges 2.9% + $0.30 on Shopify Payments (or higher on third-party gateways). Amazon sellers lose 30-40% to referral fees, FBA fees, and storage. These fees compound and often total 5-8% of revenue on Shopify and 30%+ on Amazon.

Using Margin to Set Prices

If you have a target margin, you can reverse-engineer the required selling price:

Selling Price = Cost / (1 - Target Margin)

Example: your total cost per unit (COGS + variable costs) is $22 and you want a 40% margin:

  • Selling price = $22 / (1 - 0.40) = $22 / 0.60 = $36.67

If you want a 60% margin on the same product:

  • Selling price = $22 / (1 - 0.60) = $22 / 0.40 = $55.00

This is useful for pricing new products. Work backward from your target margin and validate whether the market will support that price. If it won't, you either need to lower costs or accept a thinner margin. For a full picture of your unit economics, try the Shopify profit calculator.

When to Use Each Margin Type

Different margin types answer different questions. Here's when each one matters:

  • Gross margin — Use when evaluating product sourcing decisions, comparing suppliers, or deciding whether a product is worth adding to your catalog. If gross margin is below 50%, the product will be hard to scale profitably.
  • Contribution margin — Use when deciding whether to keep running ads on a product. If contribution margin is positive, each sale helps cover fixed costs. If negative, every ad dollar makes things worse.
  • Net margin — Use when evaluating overall business health. This is the number investors look at, the number that determines whether you can reinvest in growth, and the number that defines whether your business is truly profitable. For benchmarks on what "good" looks like, check our ecommerce profit margin guide.

How AOV Affects Your Margin

Higher average order value improves net margin because many costs are fixed per order, not per dollar. Payment processing has a flat $0.30 component. Shipping costs don't double when the order value doubles. Ad cost per acquisition is the same whether the customer buys $30 or $60 worth of product.

A $30 AOV with a $12 CPA gives you a 40% ad cost ratio. A $60 AOV with the same $12 CPA gives you a 20% ad cost ratio. Same customer acquisition effort, double the margin room. This is why bundles and upsells are among the highest-impact levers for improving profitability.

Real Example: From Revenue to Actual Profit

Let's walk through a full month for a DTC brand doing $50,000 in revenue selling a $50 product (1,000 orders):

Line ItemAmount% of Revenue
Revenue (1,000 orders x $50)$50,000100%
COGS ($15 x 1,000)-$15,00030%
Gross Profit$35,00070%
Facebook Ads ($12 CPA x 1,000)-$12,00024%
Shipping ($5.50 x 1,000)-$5,50011%
Payment processing (2.9% + $0.30)-$1,7503.5%
Shopify plan + apps-$3000.6%
Returns (5% rate, ~$30 cost each)-$1,5003%
Software (Klaviyo, analytics, etc.)-$4000.8%
Miscellaneous overhead-$5001%
Net Profit$13,05026.1%

$50,000 in revenue turned into $13,050 in profit — a 26.1% net margin. That's actually above average for ecommerce. Many brands at this scale are closer to 10-15% net after all costs. The key drivers of this example's strong margin: reasonable COGS (30%), controlled ad spend ($12 CPA), and low return rate (5%).

Change any one variable and the picture shifts. Bump CPA to $18 and net margin drops to 14.1%. Raise COGS to $20 and it drops to 16.1%. Both changes together? 4.1%. That's how quickly margins collapse.

The Quick Margin Check

Don't have time for a full calculation? Here's a fast sanity check. Look at last month's numbers:

  1. Total revenue from your Shopify admin
  2. Total cost of goods (inventory purchased or supplier invoices)
  3. Total ad spend (Meta Ads Manager + Google Ads)
  4. Total shipping costs (carrier invoices or 3PL statement)
  5. Bank account balance change from start to end of month

If bank balance change is significantly lower than (Revenue - COGS - Ads - Shipping), you're forgetting costs. The gap is usually payment processing, platform fees, returns, and software subscriptions. Track those and your margin estimate will match reality.

For an instant calculation with all costs factored in, use the profit margin calculator or the dropshipping profit calculator if you're running a dropshipping model.

Frequently Asked Questions

What is the formula for profit margin?

Profit Margin = ((Revenue - Cost) / Revenue) x 100. For gross margin, "cost" means COGS only. For net margin, "cost" means everything — COGS, marketing, shipping, fees, and overhead. A product that sells for $50 with $20 in COGS has a 60% gross margin.

What is the difference between margin and markup?

Margin is profit as a percentage of the selling price. Markup is profit as a percentage of the cost. A product with $20 COGS sold at $50 has a 60% margin but a 150% markup. They describe the same dollar profit but use different denominators. Margin is always the lower number.

How do I calculate net profit margin?

Net Profit Margin = ((Revenue - ALL Costs) / Revenue) x 100. Include COGS, ad spend, shipping, payment processing, platform fees, returns, and overhead. If you sell $100,000 in product and your total costs are $85,000, your net margin is 15%.

What is contribution margin and why does it matter?

Contribution margin is revenue minus variable costs per unit — what each sale "contributes" toward covering fixed costs. If your $50 product has $34 in variable costs, the contribution margin is $16 (32%). You need enough orders generating that $16 each to cover your monthly fixed costs. If contribution margin is negative, more volume means more losses.

What is a good profit margin for ecommerce?

A good gross profit margin for ecommerce is 60-70%. A good net profit margin is 10-20%. Beauty and supplements tend to have the highest gross margins (60-70%), while electronics have the lowest (15-25%). If your net margin is below 5%, you're operating on thin ice.

Why is my profit margin lower than I expected?

The most common reason: hidden costs. Payment processing fees (2.9% per transaction), platform fees, return costs, chargebacks, and software subscriptions typically eat 8-15% of revenue that founders don't include in their margin estimates. Add those in and the gap between expected and actual margin usually closes.

Stop guessing. Start calculating.

True Margin gives ecommerce founders the tools to make data-driven decisions.

Try True Margin Free