This free comparative advantage calculator finds each producer’s opportunity costs, who has the absolute and comparative advantage in each good, who should specialize in what, and the range of terms of trade that benefits both sides. It works with output tables and input tables, draws both production possibilities curves, and explains each step in AP® Macroeconomics and AP® Microeconomics language.
How to use the comparative advantage calculator
- Pick the data format. Output means the table shows the most each producer can make. Input means it shows the hours (or workers, or days) needed to make one unit.
- Name the goods and producers by typing over “wheat,” “cloth,” “A” and “B” in the table.
- Enter the four numbers. Decimals and fractions like 1/2 both work.
- Read the verdict: who makes what, and the terms of trade that help both.
- Check the details: the opportunity cost table (the comparative advantage is marked), the absolute and comparative advantage summary, both PPCs, and the steps.
Worked example
In one day, A can make 10 wheat or 20 cloth, and B can make 6 wheat or 6 cloth. Who has the comparative advantage in each good, and what terms of trade benefit both?
- Opportunity costs (output, so “other over”): for A, 1 wheat costs 20 ÷ 10 = 2 cloth and 1 cloth costs 10 ÷ 20 = 0.5 wheat. For B, 1 wheat costs 6 ÷ 6 = 1 cloth and 1 cloth costs 1 wheat.
- Absolute advantage: A makes more of both goods (10 > 6 and 20 > 6), so A has the absolute advantage in both.
- Comparative advantage: B gives up less cloth per wheat (1 < 2), so B has the comparative advantage in wheat. A gives up less wheat per cloth (0.5 < 1), so A has the comparative advantage in cloth.
- Specialize: B makes wheat and A makes cloth.
- Terms of trade: the price of 1 wheat has to fall between 1 and 2 cloth. At 1.5 cloth per wheat, B gets more cloth for each wheat than it could make itself, and A pays less for wheat than it would cost A to make.
Opportunity cost is the starting point
Every comparative advantage problem comes down to opportunity cost: what you give up to get one more unit of something. When A spends the day making 10 wheat, A gives up the 20 cloth it could have made instead, so each wheat costs A 2 cloth. Opportunity cost is always measured in the other good, not in dollars or hours.
With two goods, the two opportunity costs for a producer are reciprocals of each other. If 1 wheat costs A 2 cloth, then 1 cloth costs A 1/2 wheat. That’s why a producer can never have the comparative advantage in both goods: being cheaper at one automatically means being more expensive at the other.
Absolute vs. comparative advantage
- Absolute advantage is about amounts: who can make more of a good with the same resources, or the same amount with fewer resources.
- Comparative advantage is about costs: who gives up less to make a good, meaning who has the lower opportunity cost.
In the worked example, A has the absolute advantage in both goods, yet B still has the comparative advantage in wheat. That is the central idea, first laid out by economist David Ricardo in 1817: specialization should follow comparative advantage, not absolute advantage. Even a producer that’s worse at everything has something it gives up less to make.
Output problems vs. input problems
AP Economics questions come in two formats, and the opportunity cost formula flips between them. A quick way to remember it is “other over” for output and “IOU” (input, other under) for input:
| Format | The table shows | Opportunity cost of good X | Absolute advantage |
|---|---|---|---|
| Output | How much each producer can make | Other good ÷ good X (other over) | The larger number |
| Input | Hours (or workers) needed for one unit | Good X’s hours ÷ other good’s hours (other under) | The smaller number |
The same producers can be written either way. If A takes 2 hours per wheat and 1 hour per cloth, then in a 20-hour day A makes 10 wheat or 20 cloth, the output table from the worked example. Either format gives the same opportunity cost: 2 ÷ 1 = 2 cloth per wheat from the input table, and 20 ÷ 10 = 2 cloth per wheat from the output table. Mixing up the two rules is the most common way to get these questions wrong, so always decide which format you have first.
Specialization and gains from trade
When each producer specializes in its comparative advantage, total output goes up. Suppose A and B each split their day in half: A makes 5 wheat and 10 cloth, B makes 3 wheat and 3 cloth, for a total of 8 wheat and 13 cloth. Now let B make only wheat (6) and have A make 2 wheat and spend the rest of its day on cloth (16). The total is still 8 wheat, but cloth rises from 13 to 16. The extra 3 cloth comes purely from putting each task where it costs the least.
Trade lets both sides share that gain. With B making 6 wheat and A making 20 cloth, suppose they trade 3 wheat for 4.5 cloth, a price of 1.5 cloth per wheat. B ends with 3 wheat and 4.5 cloth; on its own, 3 wheat would leave B only 3 cloth. A ends with 3 wheat and 15.5 cloth; on its own, 3 wheat would leave A only 14 cloth. Both consume at a point outside their own PPC, which is impossible without trade.
Finding the terms of trade
The terms of trade are the price of one good in units of the other. For trade to help both producers, the price has to fall strictly between their two opportunity costs. The seller has to get more than it costs them to make the good, and the buyer has to pay less than it would cost them. In the example, wheat costs B 1 cloth and A 2 cloth, so any price between 1 and 2 cloth per wheat works. A price outside that range leaves one side better off making the good itself.
You can state the same range the other way around: between 1/2 and 1 wheat per cloth. AP questions often give a proposed price and ask whether both sides benefit, so check it against both opportunity costs.
Reading comparative advantage on a PPC
With constant opportunity costs, each producer’s production possibilities curve (PPC) is a straight line from its maximum of one good to its maximum of the other. The slope is the opportunity cost. With wheat on the horizontal axis, a steeper line means more cloth given up for each wheat, so the producer with the flatter PPC has the comparative advantage in the good on the horizontal axis. The calculator draws both curves on the same axes so you can compare the slopes directly.
Common mistakes
- Using absolute advantage to decide who specializes. Only comparative advantage decides that.
- Using “other over” on an input table. With hours per unit, it flips to “other under.”
- Saying one producer has the comparative advantage in both goods. That can’t happen; if the opportunity costs are equal, neither has it.
- Picking terms of trade at one of the opportunity costs. At exactly 1 or 2 cloth per wheat, one side gains nothing. The price has to be strictly between them.
Comparative advantage on the AP Economics exams
Comparative advantage and trade are in Unit 1 of both AP® Macroeconomics and AP® Microeconomics, and they show up in multiple-choice questions and free-response questions alike. Review the ideas in Absolute vs. Comparative Advantage and Production Possibilities Curve (PPC), keep the AP® Macroeconomics Unit 1 Cheat Sheet handy, and estimate your exam score with the AP® Macroeconomics Score Calculator or the AP® Microeconomics Score Calculator.
FAQ
How do you calculate comparative advantage?
Find each producer’s opportunity cost of one unit of each good, then compare. Whoever gives up less has the comparative advantage. If A can make 10 wheat or 20 cloth, one wheat costs A 20 ÷ 10 = 2 cloth. If B can make 6 of either, one wheat costs B 1 cloth, so B has the comparative advantage in wheat and A has it in cloth.
What is the difference between absolute and comparative advantage?
Absolute advantage means making more of a good with the same resources (or the same amount with fewer resources). Comparative advantage means making it at a lower opportunity cost. A producer can have the absolute advantage in both goods, but it can only have the comparative advantage in one, and comparative advantage is what decides who should specialize in what.
How do you find mutually beneficial terms of trade?
The price of one good has to fall between the two producers’ opportunity costs. If one wheat costs A 2 cloth and costs B 1 cloth, any price between 1 and 2 cloth per wheat helps both: B sells wheat for more than it costs B to make, and A buys it for less than it costs A to make. A price of 1.5 cloth per wheat works.
How do you solve input problems versus output problems?
In an output problem the table shows how much each producer can make, and the opportunity cost of a good is the other good’s number divided by this good’s number (“other over”). In an input problem the table shows the hours needed for one unit, so it flips: this good’s hours divided by the other good’s hours (“other under”).
When are there no gains from trade?
When both producers have the same opportunity cost. If both give up half a taco for each pizza, neither has a comparative advantage, so specializing and trading can’t make either one better off.