When you would happily have paid 50 for something priced at 20, the 30 difference is your consumer surplus: value received above the price paid. Add that gap over every buyer and every unit, and with a straight-line demand curve it forms the triangle this site's calculator measures, half of the height of willingness to pay over price, times the quantity sold. Sellers have the mirror image. A farmer who would have accepted 5 but receives 20 pockets producer surplus on every unit, the triangle above the supply curve and below the price. These are not bookkeeping tricks. They are the gains from trade made visible, the reason voluntary exchange is not a zero-sum scramble: both triangles exist at once, and both sides of the same transaction walk away richer than their minimum terms.
Once gains are measurable, policies can be scored. A tax drives a wedge between what buyers pay and sellers receive; both triangles shrink, and the part that vanishes entirely, captured by nobody, is the deadweight loss, the pure cost of the distortion. A price ceiling transfers some surplus from producers to consumers while destroying some outright, which is why economists keep asking not just who gains but what disappears. Trade creates surplus by enlarging both triangles; monopoly shrinks them by restricting quantity to raise price, transferring consumer surplus to the producer and destroying the rest. The framework also disciplines fairness arguments: a policy that helps consumers by shrinking total surplus a little may be worth it, but the shrinkage should be admitted and priced, not wished away.
Surplus is measured in money, and money is not welfare. A pound of surplus to a millionaire and to a struggling family count the same in the triangles and very differently in life, which is why surplus analysis informs efficiency questions and stays silent on justice unless distributional weights are added. Willingness to pay also reflects ability to pay: the demand curve of the rich shouts louder than the needs of the poor, a known and serious limitation when the method is applied to healthcare or water. Behavioural quirks bend the picture too, since people value avoiding losses more than gaining the same amount. Used within its limits, though, surplus remains the sharpest everyday tool for the question at the heart of microeconomics: when a market or a rule changes, who gains, who loses, and what value quietly evaporates between them.