{
  "id": "consumer-surplus",
  "version": "e95005b56b98",
  "status": "published",
  "name": "Consumer Surplus Calculator",
  "question": "What is the consumer surplus?",
  "summary": "Computes consumer surplus and producer surplus from the market price and quantity with straight-line demand and supply, or for single purchases, with total social surplus.",
  "category": "finance",
  "subcategory": "business",
  "url": "https://www.acalculator.org/finance/consumer-surplus-calculator",
  "markdown": "https://www.acalculator.org/finance/consumer-surplus-calculator.md",
  "kind": "function",
  "method": "Lines: CS = ½ × Q × (highest price − P), PS = ½ × Q × (P − lowest price). Same value per unit: CS = Q × (highest price − P), PS = Q × (P − lowest price). Social surplus = CS + PS.",
  "assumptions": [
    "Lines mode: demand and supply are straight lines through the market point, so each surplus is a triangle.",
    "Same value per unit: every unit is worth the same to the buyer and costs the same to the seller."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "mode": {
        "title": "Market",
        "description": "Straight-line demand and supply curves, or purchases where every unit has the same value and cost.",
        "type": "string",
        "enum": [
          "linear",
          "single"
        ]
      },
      "p": {
        "title": "Market price",
        "description": "The price buyers pay and sellers receive for each unit.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 1000000000000
      },
      "q": {
        "title": "Quantity sold",
        "description": "How many units are bought and sold at the market price.",
        "type": "number",
        "minimum": 0,
        "maximum": 1000000000000000
      },
      "pmax": {
        "title": "Highest price a buyer would pay",
        "description": "Where the demand line meets the price axis: the price at which nobody would buy. For one buyer, the most they would pay per unit.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 1000000000000
      },
      "pmin": {
        "title": "Lowest price a seller would accept",
        "description": "Optional: where the supply line meets the price axis, or the least the seller would take per unit. Leave empty to skip producer surplus.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 1000000000000
      }
    }
  },
  "outputs": {
    "consumer": {
      "label": "Consumer surplus",
      "description": "What buyers would have paid minus what they paid, in total.",
      "format": "money"
    },
    "producer": {
      "label": "Producer surplus",
      "description": "What sellers received minus the least they would have accepted, in total.",
      "format": "money"
    },
    "social": {
      "label": "Social surplus",
      "description": "Consumer surplus + producer surplus.",
      "format": "money"
    },
    "perUnit": {
      "label": "Consumer surplus per unit",
      "description": "Consumer surplus ÷ quantity.",
      "format": "money"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "mode": "linear",
      "p": 80,
      "q": 28,
      "pmax": 120,
      "pmin": 40
    },
    "outputs": {
      "consumer": 560,
      "producer": 560,
      "social": 1120,
      "perUnit": 20
    },
    "text": "Consumer surplus is $560.00."
  },
  "examples": [
    {
      "given": {
        "mode": "linear",
        "p": 80,
        "q": 28,
        "pmax": 120,
        "pmin": 40
      },
      "expect": {
        "consumer": 560,
        "producer": 560,
        "social": 1120,
        "perUnit": 20
      },
      "source": "OpenStax, Principles of Economics 3e, §3.5 (equilibrium $80 and 28 million tablets; consumer surplus = what buyers would pay − what they pay); the $120 and $40 intercepts are assumed; hand calculation in content.mdx: ½ × 28 × 40 = 560; https://openstax.org/books/principles-economics-3e/pages/3-5-demand-supply-and-efficiency"
    },
    {
      "given": {
        "mode": "single",
        "p": 30,
        "q": 1,
        "pmax": 45,
        "pmin": 18
      },
      "expect": {
        "consumer": 15,
        "producer": 12,
        "social": 27
      },
      "source": "OpenStax, Principles of Economics 3e, §3.5 (definitions of consumer and producer surplus); hand calculation in content.mdx; https://openstax.org/books/principles-economics-3e/pages/3-5-demand-supply-and-efficiency"
    },
    {
      "given": {
        "mode": "linear",
        "p": 10,
        "q": 100,
        "pmax": 30
      },
      "expect": {
        "consumer": 1000,
        "perUnit": 10
      },
      "source": "OpenStax, Principles of Economics 3e, §3.5; hand calculation in content.mdx: ½ × 100 × (30 − 10) = 1,000; https://openstax.org/books/principles-economics-3e/pages/3-5-demand-supply-and-efficiency"
    }
  ],
  "sources": [
    "OpenStax. Principles of Economics 3e, §3.5 Demand, Supply, and Efficiency (consumer surplus, producer surplus, social surplus; tablet example at $80 and 28 million), retrieved 2026-10-18. https://openstax.org/books/principles-economics-3e/pages/3-5-demand-supply-and-efficiency"
  ],
  "related": [
    "deadweight-loss",
    "price-elasticity-of-demand",
    "comparative-advantage",
    "gdp"
  ],
  "changelog": []
}
