Gross Profit Margin Calculator Formula

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

Formulas Used

Gross Profit

gross_profit = revenue - cogs

Gross Profit Margin

gross_margin = revenue > 0 ? ((revenue - cogs) / revenue) * 100 : 0

COGS as % of Revenue

cogs_pct = revenue > 0 ? (cogs / revenue) * 100 : 0

Variables

VariableDescriptionDefault
revenueRevenue(USD)800000
cogsCost of Goods Sold (COGS)(USD)320000

How It Works

How to Calculate Gross Profit Margin

Formula

Gross Profit = Revenue - COGS Gross Profit Margin = (Gross Profit / Revenue) x 100

Gross profit margin strips away only the direct costs of production, leaving a clear picture of how efficiently you convert raw materials and labor into sellable products. It is the first profitability checkpoint: if gross margin is weak, no amount of overhead control will produce healthy net profits.

Worked Example

A company has $800,000 in revenue and $320,000 in cost of goods sold.

revenue = 800000cogs = 320000
  1. 01Gross Profit = $800,000 - $320,000 = $480,000
  2. 02Gross Profit Margin = ($480,000 / $800,000) x 100 = 60%
  3. 03COGS as % of Revenue = ($320,000 / $800,000) x 100 = 40%

Frequently Asked Questions

What costs go into COGS?

COGS includes direct materials, direct labor, and manufacturing overhead directly tied to production. It does not include selling expenses, administrative costs, or interest payments.

What is a healthy gross margin?

Software/SaaS typically targets 70-90%. Professional services range from 50-70%. Manufacturing sits at 25-50%. Retail averages 25-50%. The wider your gross margin, the more room you have for operating expenses and profit.

Ready to run the numbers?

Open Gross Profit Margin Calculator