Profit Margin Calculator Formula

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

Formulas Used

Profit Margin

profit_margin = revenue > 0 ? ((revenue - total_costs) / revenue) * 100 : 0

Net Profit

net_profit = revenue - total_costs

Cost-to-Revenue Ratio

cost_ratio = revenue > 0 ? (total_costs / revenue) * 100 : 0

Variables

VariableDescriptionDefault
revenueTotal Revenue(USD)150000
total_costsTotal Costs(USD)120000

How It Works

How to Calculate Profit Margin

Formula

Profit Margin % = [(Revenue - Total Costs) / Revenue] x 100

Profit margin is one of the most critical measures of business health. It shows how much of each dollar in revenue your business keeps as profit after paying all expenses.

Worked Example

A business earns $150,000 in revenue with $120,000 in total costs.

revenue = 150000total_costs = 120000
  1. 01Net profit = $150,000 - $120,000 = $30,000
  2. 02Profit margin = ($30,000 / $150,000) x 100 = 20%
  3. 03Cost-to-revenue ratio = ($120,000 / $150,000) x 100 = 80%

Ready to run the numbers?

Open Profit Margin Calculator