Gross Margin Calculator Formula

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

Formulas Used

Gross Margin

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

Gross Profit

gross_profit = revenue - cogs

COGS as % of Revenue

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

Variables

VariableDescriptionDefault
revenueRevenue(USD)200000
cogsCost of Goods Sold (COGS)(USD)80000

How It Works

How to Calculate Gross Margin

Formula

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

Gross margin measures how efficiently a company generates profit from its direct costs. A higher gross margin means more money is available to cover operating expenses and generate net profit.

Worked Example

A company has $200,000 in revenue and $80,000 in cost of goods sold.

revenue = 200000cogs = 80000
  1. 01Gross profit = $200,000 - $80,000 = $120,000
  2. 02Gross margin = ($120,000 / $200,000) x 100 = 60%
  3. 03COGS ratio = ($80,000 / $200,000) x 100 = 40%

Ready to run the numbers?

Open Gross Margin Calculator