Consumer and producer surplus calculator

Type the demand and supply lines, or drag them. You get the equilibrium, the consumer surplus triangle, the producer surplus triangle and the total, with each area shaded and labelled so you can see where the numbers come from.

Inputs

The most anyone would pay for the first unit (a in P = a − bQ). If your book writes demand as Qd = 16 − 2P, turn it round first: P = 8 − 0.5Q, so a = 8.

How much the price falls for each extra unit (b). Enter it as a positive number.

The least any seller will accept for the first unit (c in P = c + dQ). It can be negative.

How much the price must rise for each extra unit sellers offer (d).

Only matters when the supply intercept is negative. Some courses count producer surplus only above a price of 0.

The most that buyer would pay. Their surplus is that minus the market price, or nothing if it is below the price.

The least that seller would take. Their surplus is the market price minus that, or nothing if it is above the price.

Total surplus

1,350

Buyers keep 900 and sellers 450 at a price of 40 and a quantity of 30.

Consumer surplus
900
Producer surplus
450
Share going to buyers
67%
Equilibrium
P* 40 · Q* 30
Demand
P = 100 − 2Q
Supply
P = 10 + Q
Consumer and producer surplus
DS
  • Demand (D)
  • Supply (S)
  • Consumer surplus 900
  • Producer surplus 450

Drag a line, its round knob or its ring to move it. On a keyboard, tab to a knob and use the arrow keys.

Demand P = 100 − 2Q and supply P = 10 + Q cross at a price of 40 and a quantity of 30. Consumer surplus, the triangle under demand and above the price, is 900. Producer surplus, the area above supply and below the price, is 450. Together they make a total surplus of 1,350, and buyers hold 67% of it.

How to read this graph

  • Price goes up the side, quantity along the bottom. The blue line is demand and the orange line is supply; drag either one, or type its equation.
  • The dot where they cross is the equilibrium. The dashed lines run from it to the price and quantity axes.
  • The blue triangle is consumer surplus. It starts at the top of the demand line, where the first buyer would pay the most, and shrinks to nothing at the equilibrium price.
  • The orange triangle is producer surplus. It starts at the bottom of the supply line, where the first seller would take the least.
  • The two add up to total surplus, the most the market can create. Move a line and watch which triangle grows.

How it works

demand   P = a − b × Q        supply   P = c + d × Q
equilibrium   Q* = (a − c) ÷ (b + d)     P* = a − b × Q*
consumer surplus = ½ × Q* × (a − P*)
producer surplus = ½ × Q* × (P* − c)
total surplus    = consumer surplus + producer surplus = ½ × Q* × (a − c)
  • a is where demand meets the price axis: the most anyone would pay for the first unit. c is where supply meets it: the least any seller will take.
  • Each surplus is a triangle: half the base (the quantity traded) times the height (the gap between the price and that line’s intercept).
  • The split is b to d. Consumer surplus ÷ producer surplus = b ÷ d.
  • One buyer’s surplus is their willingness to pay minus the price, or nothing if it is below the price. One seller’s is the price minus their lowest acceptable price.
  • Supply below zero. If c is negative, the triangle runs below a price of 0. By default it does, as the Supply & Demand Studio does. Choose “Stop supply at 0” to count only the part above zero, which gives a trapezoid.
  • Nothing has units. Use dollars and units, euros and tonnes, or whatever your problem uses.

Worked example

Penn State’s market: demand P = 100 − 2Q and supply P = 10 + Q. Open it in the calculator.

  • Equilibrium: 100 − 2Q = 10 + Q, so Q* = 30 and P* = 100 − 2 × 30 = 40.
  • Consumer surplus: the height is 100 − 40 = 60, so ½ × 30 × 60 = 900.
  • Producer surplus: the height is 40 − 10 = 30, so ½ × 30 × 30 = 450.
  • Total: 900 + 450 = 1,350. A buyer willing to pay 70 makes 70 − 40 = 30; a seller who would take 30 makes 40 − 30 = 10.

More to try:

Tips

  • Check the graph first. If your Q* does not sit under the crossing point, one of your equations is probably still in the Qd = … form.
  • Surplus is an area, not a price. Its units are price times quantity, so dollars × units is just dollars.
  • Try a shift. Drag demand up and to the right and both triangles grow, because the price rises and more is traded.
  • Compare with a tax. The tax incidence tool shows how much of these triangles a per-unit tax takes away.
  • The model is a simplification. Real demand and supply curves bend, and real buyers differ in ways a straight line cannot capture.

FAQ

What are consumer surplus and producer surplus?

Consumer surplus is what buyers would have been willing to pay minus what they actually pay. On the graph it is the triangle under the demand line and above the price. Producer surplus is what sellers receive minus the least they would have accepted, the triangle above the supply line and below the price. Their sum, total surplus, is the gain from trade.

My book gives demand as Qd = 50 − 0.5P. How do I enter it?

Turn it round so price is on its own. Qd = 50 − 0.5P becomes P = 100 − 2Q, so the demand intercept is 100 and the slope 2. Divide everything by the number in front of P. The Demand and Supply chips under the result show both forms, so you can check your conversion.

Why do I get a different producer surplus when my supply line starts below zero?

A supply line with a negative intercept, like Qs = 100P + 800, means sellers would supply 800 units even at a price of zero. Some courses follow the line down into negative prices, which gives a triangle. The Wisconsin gasoline problem stops supply at zero and gets a trapezoid, 4,000 instead of 7,200. The selector lets you choose either; with a positive intercept it makes no difference.

Why does the steeper line keep more of the surplus?

For straight lines the surplus splits in the ratio of the slopes, b to d. A steep demand line means buyers are not very sensitive to price, so they gain more from trade, and a steep supply line does the same for sellers.

Can I use this for homework?

Yes, to check your answers and to see where each area comes from. The numbers match Penn State's worked example, two University of Wisconsin homework keys and Kansas State's welfare-analysis chapter. Show your own working, and use the download button if you want the graph.

Sources

  1. Market Equilibrium Example (EBF 200), Penn State University, College of Earth and Mineral Sciences. P = 100 − 2Qd and P = 10 + Qs give Q* = 30 and P* = 40, consumer surplus 900, producer surplus 450, and what one buyer or seller makes at a given willingness to pay or accept.
  2. ECON 101 Spring 2015, Homework #3 (answers), question 1b and 1e, University of Wisconsin–Madison, Economics 101 (Emily Kelly). Hot chocolate, Qs = 5P − 5 and Qd = 100 − 10P, with consumer surplus $45 and producer surplus $90, then $125 and $250 after demand rises by 60.
  3. ECON 101 Fall 2012, Answers to Homework #2, question 4 (Dane County gasoline), University of Wisconsin–Madison, Economics 101 (teaching assistant Kanit Kuevibulvanich). Qd = 2000 − 200P and Qs = 100P + 800, where consumer surplus is 3,600 and producer surplus is a trapezoid of 4,000 because supply starts below a price of zero.
  4. The Economics of Food and Agricultural Markets, 2.1 Price Ceiling, Andrew Barkley, Kansas State University (New Prairie Press), via LibreTexts. P = 20 − 2Q and P = 4 + 2Q with consumer surplus 16, producer surplus 16 and social welfare 32.

Formula and sources last checked September 30, 2026. How we test formulas.