{
  "id": "margin",
  "version": "eaa42620496d",
  "status": "published",
  "name": "Margin Calculator",
  "question": "What is my profit margin?",
  "summary": "Computes the profit margin (profit as a percent of the selling price) and the markup from any two of cost, selling price, profit and margin.",
  "category": "finance",
  "subcategory": "business",
  "url": "https://www.acalculator.org/finance/margin-calculator",
  "markdown": "https://www.acalculator.org/finance/margin-calculator.md",
  "kind": "formulas",
  "method": "M = P ÷ R × 100, where P = R − C. C is the cost, R the selling price, P the profit and M the margin.",
  "assumptions": [
    "The cost and the selling price are more than 0.",
    "The margin is a percent of the revenue (the selling price); the markup is a percent of the cost.",
    "A loss gives a negative profit and a negative margin. Margins run from −1,000% (a cost 11 times the revenue) to just under 100%; numbers outside that range, or that need a cost or revenue of 0 or less, have no answer."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "revenue": {
        "title": "Selling price",
        "description": "The price you sell the item for (the revenue).",
        "type": "number",
        "x-unit": "USD",
        "exclusiveMinimum": 0,
        "maximum": 1000000000000
      },
      "cost": {
        "title": "Cost",
        "description": "What the item costs you to buy or make.",
        "type": "number",
        "x-unit": "USD",
        "exclusiveMinimum": 0,
        "maximum": 1000000000000
      },
      "margin": {
        "title": "Margin",
        "description": "The profit as a percent of the selling price: profit ÷ price × 100.",
        "type": "number",
        "x-unit": "percent",
        "minimum": -1000,
        "exclusiveMaximum": 100
      },
      "profit": {
        "title": "Profit",
        "description": "The selling price minus the cost. Negative for a loss.",
        "type": "number",
        "x-unit": "USD",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      }
    }
  },
  "solve": {
    "fillAny": 2,
    "variables": [
      "revenue",
      "cost",
      "margin",
      "profit"
    ],
    "inputsOnly": []
  },
  "outputs": {
    "revenue": {
      "label": "Selling price",
      "description": "The price you sell the item for (the revenue).",
      "format": "money"
    },
    "cost": {
      "label": "Cost",
      "description": "What the item costs you to buy or make.",
      "format": "money"
    },
    "margin": {
      "label": "Profit margin",
      "description": "The profit as a percent of the selling price: profit ÷ price × 100.",
      "format": "percent"
    },
    "profit": {
      "label": "Profit",
      "description": "The selling price minus the cost. Negative for a loss.",
      "format": "money"
    },
    "markup": {
      "label": "Markup",
      "description": "The profit as a percent of the cost: P ÷ C × 100.",
      "format": "percent"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "revenue": 120,
      "cost": 90
    },
    "outputs": {
      "margin": 25,
      "profit": 30,
      "markup": 33.33333333333333
    },
    "text": "Selling for $120.00 at a cost of $90.00 is a profit of $30.00: a 25% margin and a 33.33% markup."
  },
  "examples": [
    {
      "given": {
        "cost": 70,
        "revenue": 100
      },
      "expect": {
        "profit": 30,
        "margin": 30,
        "markup": 42.857142857142854
      },
      "source": "hand calculation in content.mdx: 100 − 70 = 30; 30 ÷ 100 × 100 = 30%; 30 ÷ 70 × 100 = 42.86%"
    },
    {
      "given": {
        "cost": 60,
        "margin": 25
      },
      "expect": {
        "revenue": 80,
        "profit": 20,
        "markup": 33.33333333333333
      },
      "source": "hand calculation in content.mdx: 60 ÷ (1 − 0.25) = 80; 80 − 60 = 20; 20 ÷ 60 × 100 = 33.33%"
    },
    {
      "given": {
        "revenue": 250,
        "margin": 40
      },
      "expect": {
        "profit": 100,
        "cost": 150,
        "markup": 66.66666666666666
      },
      "source": "hand calculation in content.mdx: 250 × 0.40 = 100; 250 − 100 = 150; 100 ÷ 150 × 100 = 66.67%"
    },
    {
      "given": {
        "cost": 120,
        "revenue": 100
      },
      "expect": {
        "profit": -20,
        "margin": -20,
        "markup": -16.666666666666664
      },
      "source": "hand calculation in content.mdx: a loss: 100 − 120 = −20; −20 ÷ 100 × 100 = −20%"
    }
  ],
  "sources": [
    "U.S. Securities and Exchange Commission, Beginners' Guide to Financial Statements (gross profit is revenue minus cost of sales; margins are shown as a percent of each dollar of sales). https://www.sec.gov/about/reports-publications/beginners-guide-financial-statements",
    "Hand derivation of the rearrangements from M = (R − C) ÷ R × 100 (shown in full below)."
  ],
  "related": [
    "gross-margin",
    "markup",
    "percentage"
  ],
  "changelog": [
    {
      "date": "2026-09-29",
      "note": "The page opens with a price and a cost, so the headline is the margin and a typed price and cost never clash (user test 2026-09-29)."
    }
  ]
}
