Skip to content

Comparative Advantage Calculator

Enter what two producers can make of two goods, in output or in hours per unit, and the calculator finds each opportunity cost, separates absolute from comparative advantage, names who should specialize in what, and gives the range of prices at which trade helps both sides. Each producer gets a production possibilities graph with the trade line drawn in.

Producers and goods

The numbers

Leave blank to use the middle of the range.

Results

Opportunity costs

ProducerOpportunity cost of 1 wheat (in cloth)Opportunity cost of 1 cloth (in wheat)
Country A1 cloth1 wheat
Country B2 cloth0.5 wheat
  • Country A: 1 wheat costs 60 ÷ 60 = 1 cloth; 1 cloth costs 60 ÷ 60 = 1 wheat
  • Country B: 1 wheat costs 40 ÷ 20 = 2 cloth; 1 cloth costs 20 ÷ 40 = 0.5 wheat

Country A

Absolute advantage in wheat

Country A

Absolute advantage in cloth

Country A

Comparative advantage in wheat

Country B

Comparative advantage in cloth

Absolute advantage means making more with the same resources. Comparative advantage means giving up less of the other good, so a producer can have the first in both goods but the second in only one.

Gains from trade

Trade helps both sides when 1 wheat sells for more than 1 cloth and less than 2 cloth.

Seen from the other side, 1 cloth should trade for between 0.5 and 1 wheat.

At 1.5 cloth per wheat: Country A gains 0.5 cloth for every wheat it sells, and Country B saves 0.5 cloth for every wheat it buys.

Together the two gain 1 cloth for every unit of wheat traded, whatever price they settle on; the price only decides who gets how much of it.

Country A: production possibilities and tradeProduction possibilities frontier for Country A: a straight line from 60 units of cloth on the vertical axis to 60 units of wheat on the horizontal axis. A dashed line shows what the producer can consume after specializing and trading.Country A: production possibilities and tradewheatcloth0204060801000102030405060PPFWith tradeSpecialize
Show the graph data as a table
Curvewheatcloth
PPF600
PPF060
With trade600
With trade090
Country B: production possibilities and tradeProduction possibilities frontier for Country B: a straight line from 40 units of cloth on the vertical axis to 20 units of wheat on the horizontal axis. A dashed line shows what the producer can consume after specializing and trading.Country B: production possibilities and tradewheatcloth010203040051015202530PPFWith tradeSpecialize
Show the graph data as a table
Curvewheatcloth
PPF200
PPF040
With trade040
With trade26.670

The dashed line starts where the producer puts every resource into its better good and shows what it can consume by trading at the chosen price. It lies outside the frontier whenever that price beats the producer’s own opportunity cost.

How to Use the Comparative Advantage Calculator

  1. 1. Choose how your problem gives the data. Either the most each producer can make of each good in a period (output), or the hours each needs to make one unit. With hours, also say how many hours each has available.
  2. 2. Rename the producers and goods. The defaults are two countries making wheat and cloth. Type your own, such as Farmer and Rancher, and the labels and graphs update.
  3. 3. Enter the four numbers. Each must be above zero. Both producers' figures must describe the same period, or the same hours.
  4. 4. Read the verdict and the graphs. The table gives opportunity costs, the cards show who has which advantage, and the trade section gives the price range. Enter your own terms of trade to see how the gain is split.

Opportunity Cost and the Two Kinds of Advantage

The opportunity cost of a good is what you give up to get it. If a producer can make 60 units of wheat or 60 of cloth in a period, one unit of wheat costs one unit of cloth. If it can make 20 of wheat or 40 of cloth, one unit of wheat costs two units of cloth. With a straight-line frontier the formulas are simple:

From maximum output

Cost of 1 unit of good 1 = max output of good 2 ÷ max output of good 1

From hours per unit

Cost of 1 unit of good 1 = hours per unit of good 1 ÷ hours per unit of good 2

A producer has an absolute advantage in a good if it makes more of it with the same resources, or needs fewer hours. It has a comparative advantage if its opportunity cost of that good is lower. The two are different tests, and the difference is the point of the idea: a producer can be better at everything and still have a comparative advantage in only one good, because two producers cannot both have the lower opportunity cost of the same good.

Worked Example: One Country Better at Everything

The calculator opens with Country A able to make 60 wheat or 60 cloth, and Country B 20 wheat or 40 cloth.

Country ACountry BComparative advantage
Cost of 1 wheat (in cloth)12Country A
Cost of 1 cloth (in wheat)10.5Country B

Country A has the absolute advantage in both goods, yet it has the comparative advantage only in wheat, where it gives up less cloth for each unit. Country B is worse at making both, but cloth costs it only half a unit of wheat, against one for A. A should specialize in wheat and B in cloth.

Terms of Trade and the Gains

Country A will sell wheat only for more than the 1 cloth it gives up making it, and B will buy wheat only for less than the 2 cloth it would give up making its own. So any price strictly between 1 and 2 cloth per wheat makes both better off. At 1.5, A gains half a unit of cloth for every unit of wheat it sells, and B saves half a unit of cloth for every unit it buys. The total gain per unit traded is always the gap between the two opportunity costs, 2 − 1 = 1 cloth; the price only decides how the gap is shared.

On each graph the solid line is the producer's own frontier, so it can only consume what it makes. The dashed line starts at the point where it puts everything into its better good and shows what it can consume by trading at the chosen price. In the example, A selling all 60 wheat at 1.5 could consume up to 90 cloth, where alone it was limited to 60. The graph is drawn with straight lines, which means constant opportunity cost; real frontiers usually bow outward, so treat the numbers as a model.

Frequently Asked Questions

What is the difference between absolute and comparative advantage?
Absolute advantage compares productivity: who makes more of a good with the same resources. Comparative advantage compares opportunity cost: who gives up less of the other good to make it. One producer can hold an absolute advantage in both goods, but the two producers cannot both hold the comparative advantage in the same one.
Why should a country that is better at everything still trade?
Because its time is limited, and making a good costs it the other good it could have made. If a partner can make one of the goods at a lower opportunity cost, the better producer gains by buying that good and spending its own resources on the good where its cost is lowest. This was David Ricardo's point in 1817.
How do I find opportunity cost from a table of hours?
Divide the hours per unit of the good you are getting by the hours per unit of the good you give up. If wheat takes 1 hour and cloth takes 2 hours, one unit of wheat costs half a unit of cloth, because the hour spent on wheat could have made half a unit of cloth.
What are the terms of trade?
They are the rate at which the goods exchange, such as 1.5 cloth for 1 wheat. Trade benefits both sides only if that rate lies strictly between the two producers' opportunity costs. At either end of the range, one side gains nothing.
What does a straight-line PPF assume?
It assumes constant opportunity cost: every extra unit of a good costs the same amount of the other. That is true when resources are equally good at making either good. When resources are specialized, the frontier bows outward and the opportunity cost rises with output, which the calculator does not model.
What if both producers have the same opportunity costs?
Then neither has a comparative advantage and there is no price at which trade benefits both. The calculator says so instead of giving a range. This happens when one producer's output is the other's scaled up in both goods by the same factor.

Related Tools

More in Economics, Business & Finance

See all Economics, Business & Finance