Margin Calculator Formula

Understand the math behind the margin calculator. Each variable explained with a worked example.

Formulas Used

Profit Margin

margin_pct = revenue > 0 ? ((revenue - cost) / revenue) * 100 : 0

Profit

profit = revenue - cost

Markup

markup_pct = cost > 0 ? ((revenue - cost) / cost) * 100 : 0

Variables

VariableDescriptionDefault
revenueRevenue (Selling Price)(USD)100
costCost(USD)60

How It Works

How to Calculate Profit Margin

Formula

Margin % = [(Revenue - Cost) / Revenue] x 100

Profit margin tells you what percentage of each dollar in revenue is actual profit. It is one of the most important metrics for evaluating business health.

Worked Example

A product sells for $100 and costs $60.

revenue = 100cost = 60
  1. 01Profit = $100 - $60 = $40
  2. 02Margin = ($40 / $100) x 100 = 40%
  3. 03Markup = ($40 / $60) x 100 = 66.67%

When to Use This Formula

  • Setting retail prices when you know your cost and need to hit a target profit margin percentage.
  • Comparing profitability across product lines to decide which items to promote or discontinue.
  • Preparing financial reports where gross margin and net margin must be calculated from revenue and cost of goods sold.
  • Evaluating a supplier quote to see whether the resulting margin meets your business's minimum threshold.
  • Benchmarking your margins against industry averages to identify pricing or cost problems.

Common Mistakes to Avoid

  • Confusing margin with markup — a 50% markup on a $10 cost gives a $15 price but only a 33.3% margin, not 50%.
  • Calculating margin from cost instead of revenue — margin is always (Revenue - Cost) / Revenue, not divided by cost.
  • Ignoring that gross margin and net margin are different — gross margin only subtracts direct costs, while net margin includes overhead, taxes, and all other expenses.
  • Applying a flat margin percentage to products with vastly different cost structures, which can leave low-cost items underpriced and high-cost items overpriced.

Frequently Asked Questions

What is a good profit margin?

It varies by industry. Generally, 5% is low, 10% is average, and 20%+ is high. Software companies often have 60-80% margins, while grocery stores operate at 1-3%. Always benchmark against your specific industry.

How is margin different from markup?

Margin is profit as a percentage of revenue (selling price). Markup is profit as a percentage of cost. Margin is always lower than markup for the same transaction. A 40% margin equals a 66.7% markup.

What is the formula to calculate price from a desired margin?

Price = Cost / (1 - Desired Margin). For example, if your cost is $60 and you want a 40% margin: $60 / (1 - 0.40) = $60 / 0.60 = $100 selling price.

What is gross margin vs net margin?

Gross margin subtracts only the direct cost of goods sold (COGS) from revenue. Net margin subtracts all costs — COGS, operating expenses, interest, and taxes. Gross margin is a measure of production efficiency; net margin shows overall business profitability.

Learn More

Guide

How to Calculate Profit Margin

Learn how to calculate gross, operating, and net profit margins step by step. Understand what healthy margins look like across industries and how to improve yours.

Ready to run the numbers?

Open Margin Calculator