Comparative Advantage Calculator

Enter how much of two goods each producer can make and find each one's opportunity cost, who has the comparative advantage in which good, and the combined output gained from specializing and trading.

Quick Facts

Formula
Opportunity cost = Good 2 output ÷ Good 1 output
The units of Good 2 a producer must give up to make one more unit of Good 1, holding resources fixed.
Rule
Lower opportunity cost wins
The producer that sacrifices less of the other good has the comparative advantage, regardless of who is more productive overall.
Gains from trade
Exist whenever opportunity costs differ
Any trade price between the two producers' opportunity costs makes both sides better off.

Your Results

Calculated
Producer A's opportunity cost
-
Units of Good 2 given up per unit of Good 1
Producer B's opportunity cost
-
Units of Good 2 given up per unit of Good 1
Comparative advantage
-
Who should specialize in which good
Gain from specialization
-
Extra combined output vs. a 50/50 split

Ready

Enter each producer's output of Good 1 and Good 2, then press Calculate.

What this calculator does

This calculator applies the economic concept of comparative advantage to two producers, each capable of making two goods. It finds each producer's opportunity cost for a good — how much of the other good it must give up to make one more unit — and identifies which producer should specialize in which good so that trade leaves both sides with more total output than either could reach alone.

The formula

For a producer that can make either x units of Good 1 or y units of Good 2 with the same fixed resources (labor, time, or capital), the opportunity cost of Good 1 in terms of Good 2 is:

Opportunity cost of Good 1 = y / x (units of Good 2 forgone per unit of Good 1)

Compute this ratio for both Producer A and Producer B. The producer with the lower opportunity cost of Good 1 has the comparative advantage in Good 1; the other producer automatically has the comparative advantage in Good 2 (its opportunity cost of Good 1 is higher, so its opportunity cost of Good 2 — the reciprocal — is lower). This holds even if one producer is more productive at everything in absolute terms; comparative advantage is about relative trade-offs, not raw output.

Worked example

Say Producer A can make 10 units of Good 1 or 5 units of Good 2 per day, while Producer B can make 4 units of Good 1 or 8 units of Good 2 per day. Producer A's opportunity cost of Good 1 is 5/10 = 0.50 units of Good 2; Producer B's is 8/4 = 2.00 units of Good 2. Because 0.50 is lower, Producer A has the comparative advantage in Good 1, and Producer B has the comparative advantage in Good 2. If each producer had instead split its resources evenly between the two goods, combined output would be 7 units of Good 1 and 6.5 units of Good 2. Full specialization — Producer A making only Good 1, Producer B making only Good 2 — raises combined output to 10 units of Good 1 and 8 units of Good 2, a joint gain of 3 units of Good 1 and 1.5 units of Good 2 that the two producers can then divide through trade.

Gains from trade

Specialization only helps if both sides can trade at a price that beats what each could achieve alone. That price — the terms of trade — must fall strictly between the two producers' opportunity costs of Good 1. In the example above, any trade rate between 0.50 and 2.00 units of Good 2 per unit of Good 1 leaves both producers better off than producing everything themselves. If the two opportunity costs are equal, no such price exists and there is nothing to gain from specializing.

Absolute versus comparative advantage

Absolute advantage is about who produces more of a good with the same resources. Comparative advantage is about who gives up less of the other good to do so. A producer can be more productive at both goods (have an absolute advantage in both) and still gain from trading, because what matters for mutually beneficial trade is the relative opportunity cost, not the absolute output level.

Frequently Asked Questions

How is comparative advantage calculated?
Divide each producer's output of Good 2 by its output of Good 1 to get the opportunity cost of Good 1 in terms of Good 2 forgone. The producer with the lower opportunity cost for a good has the comparative advantage in that good, even if it is not the more productive producer overall.
What is the difference between absolute and comparative advantage?
Absolute advantage means producing more output per unit of input than another producer. Comparative advantage means giving up less of the other good to produce one unit — it depends on opportunity cost, not raw output, so a producer can have an absolute advantage in both goods yet still gain from specializing in only one.
Why does trade benefit both producers?
When opportunity costs differ, each producer can specialize in the good it produces relatively cheaply and trade for the other at a price between the two opportunity costs. Both producers end up with more total goods than they could make alone, which is the basis of gains from trade.
What if both producers have the same opportunity cost?
If the opportunity costs are equal, neither producer has a comparative advantage in either good. There is no price at which both sides gain from specialization and trade, so the model shows no benefit from reallocating production.