Comparative Advantage Simulator
A two-country, two-good Ricardian model. Set how productive each country is, watch specialisation and trade move the world to a more efficient allocation. The simulator that David Ricardo would have built in 1817 if he had a laptop.
Two countries. Two goods. Even when one country is better at making both, specialisation and trade leave both with more than they could make alone. Drag the inputs to see Ricardo's maths play out.
Country A
Country B
Pre-trade allocation (no specialisation yet)
Drag the sliders to set how each country splits its labour without trade. Move them around to see how much output is lost relative to the specialised case.
Comparative advantage
England should specialise in Cloth, Portugal in Wine
Opportunity cost is what each side gives up to make a unit of the other good. England sacrifices 0.83 Wine per Cloth; Portugal sacrifices 1.13. Whoever sacrifices less has comparative advantage in that good.
Opportunity costs
How many units of one good a country gives up to make one unit of the other. The country with the lower opportunity cost in a good is the one with comparative advantage in it.
| Country | Cost of 1 Cloth (in Wine) | Cost of 1 Wine (in Cloth) |
|---|---|---|
| England | 0.833 | 1.200 |
| Portugal | 1.125 | 0.889 |
Pre-trade vs full specialisation
World output before and after each country fully specialises in the good it has comparative advantage in. Blue is the specialised number; grey is what you produced without trade.
-13.3 units (-5.3%)
+50.0 units (+20.0%)
Specialisation can produce less of one good and much more of the other. The Ricardian insight is that any combination on the joint frontier can be redistributed via trade so both countries consume more of both goods than they could in autarky. The simulator shows production; the gains for individual households come from the exchange that follows.
Why this matters
David Ricardo's 1817 argument was that even when one country is worse at producing every good than another, both countries still gain from trade. The reason is opportunity cost. The country that is bad at everything is least bad at something, and the country that is good at everything has to give up a lot of the high-value good to make the low-value one.
In the default example, Portugal can make both cloth and wine with fewer hours than England. The classical answer would be that Portugal should produce both and England should produce nothing. Ricardo's answer is the opposite: Portugal should pour everything into wine (where it is dramatically more efficient) and let England produce cloth (where its disadvantage is smallest). Both countries end up with more wine and cloth than they would have alone.
The same logic applies to two people, two firms, or two regions of the same country. Specialisation and trade is one of the few results in economics that is both mathematically tight and politically contentious.
Important: Not Financial Advice
This calculator is provided for educational and illustrative purposes only. Freedom Isn't Free is not authorised or regulated by the Financial Conduct Authority (FCA) and does not provide financial advice, investment recommendations, or tax guidance.
The projections shown are hypothetical, assume a constant rate of return, and do not account for inflation, taxes, or fees. Actual investment returns vary and you may get back less than you invest. Past performance is not a reliable indicator of future results.
Before making any financial decisions, please consult with an independent financial adviser regulated by the FCA. For help finding an adviser, visit MoneyHelper or Unbiased.
Where links to financial products appear on this page, some may be affiliate links. See our full disclaimer for details.
Something not right? Contact us
Enjoying the content?
If this site has been useful, a coffee goes a long way.