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.
What is comparative advantage?
Comparative advantage is the principle that two parties can both gain from trade even when one is more productive at everything. Each party should specialise in whatever it is relatively best at, meaning the activity with the lowest opportunity cost, not whichever activity it is absolutely best at. The simulator above forces the opportunity-cost framing because the human eye keeps trying to compare absolute productivity. Ricardo's whole point is that absolute productivity is the wrong thing to look at.
Opportunity cost is the unit you give up to make the unit you produce. If England takes 100 hours to make cloth and 120 hours to make wine, an English wine costs 1.2 English cloths in foregone production. If Portugal takes 90 hours for cloth and 80 for wine, a Portuguese wine costs only 0.89 Portuguese cloths. Portugal is absolutely more productive at both goods, yet relatively more productive at wine. England is relatively less terrible at cloth. Both gain when each specialises and trades.
Ricardo's 1817 thought experiment
David Ricardo introduced this idea in chapter 7 of On the Principles of Political Economy and Taxation, published in 1817. Two countries (England and Portugal), two goods (cloth and wine), one input (labour hours). Portugal is more productive at both. The classical conclusion would have been that Portugal should make everything and England nothing. Ricardo showed that the opposite was true. If Portugal pours all of its hours into wine and England pours all of its hours into cloth, the combined output of both goods rises. Trade then redistributes that larger pile so both countries consume more of both goods than they could alone.
The result is mathematically tight. It is also the reason almost every economics textbook in the world spends a chapter on the same two-country, two-good example. Try the Ricardo preset above, then push the input sliders around until the comparative advantage flips. The geometry of the bars changes, but the result does not: the country with the lower opportunity cost in a good should produce it.
Why almost everyone gets this wrong
The intuitive comparison is absolute. "I am faster than them at this, so I should do it." That instinct is right inside a single household chore, and wrong as soon as you have more than one task and finite time. The relevant question is not "who is better at this task" but "what is each side giving up to do it". Once that frame clicks, the applications spread well beyond international trade.
Consider a doctor who is also a faster gardener than the person they would hire to mow the lawn. Absolute advantage says the doctor should mow the lawn. Comparative advantage says no: the doctor's hour is worth far more in the clinic than in the garden, so paying someone less productive to mow it creates surplus for both parties. The simulator's "Doctor vs gardener" preset shows this exactly. The doctor specialises in medical advice, the gardener in lawn mowing, and total output of both rises.
Personal-finance applications
Three places this maths actually matters in a UK worker's life:
- Hiring help. Even if you are faster than every cleaner, accountant, and gardener you might hire, you should not do all three. Your time is most productive doing the thing you are relatively best at, usually the one that pays you. Outsourcing the rest creates net surplus for you and the person you hire. That is not a luxury reframing; it is the same maths Ricardo used.
- Dividing labour in a two-earner household. Comparative advantage is frequently invoked to argue that the lower-earning partner should specialise in unpaid household work. Be careful here. The calculation only holds if you genuinely measure both partners' productivity in both spheres and price unpaid work honestly. In practice the maths often gets loaded with assumptions about whose paid work is "real" and whose isn't. The model is a tool, not a verdict, and using it to justify a gendered division of labour that ignores career trajectory and pension accumulation is bad economics dressed up as good economics.
- Career specialisation. The case for going deep on one skill rather than being a generalist is partly a comparative-advantage argument. You give up breadth to gain depth where your opportunity cost of broadening is highest. Whether that trade is worth it depends on the market for the deep skill, which is the bit most "follow your passion" career advice skips. Use the freedom number calculator to size the buffer you need before specialising aggressively.
Why this matters in 2026: AI and the absolute-versus-comparative confusion
Most public debate about AI confuses absolute and comparative advantage. "AI is now better than humans at X" describes absolute advantage. It does not, by itself, settle whether humans should keep doing X. The relevant question is what AI gives up to do X, and that depends on what else it could be doing with the same compute, energy, and capital. As long as there is anything AI is relatively even more productive at than X, humans retain comparative advantage in X by definition.
The honest worker-protective version of this argument is that comparative advantage does not guarantee good outcomes for individual workers. It only guarantees that somewhere in the economy there is work humans should still do. Whether that work pays well, is geographically accessible, and exists in your industry are separate questions. Ricardo answers the aggregate question; he does not answer the distributional one.
The honest limits of the Ricardian model
Comparative advantage is probably the single most powerful idea in economics that almost nobody outside the discipline understands. It is also the most overused justification for trade policy that leaves identifiable groups of workers worse off. The model says both countries gain on net. It does not say everyone within each country gains. The textile workers of the English midlands and the steelworkers of the American rust belt and the manufacturing workers of northern England under NAFTA-style deals are not a rounding error on the aggregate gains. They are real people whose labour-market positions got destroyed while the gains accrued somewhere else.
The honest reading: comparative advantage is a brilliant tool for deciding how to spend your own time and what to outsource. It is a much weaker basis for labour-market policy unless paired with redistribution and retraining that actually reaches the workers who lose. Read the model for personal decisions. Read the politics with a more sceptical eye, and pair it with the FI number calculator if you are working out what financial buffer you need to survive an industry that the next round of trade liberalisation might hollow out.
Frequently asked questions
What is comparative advantage in simple terms?
How is comparative advantage different from absolute advantage?
Why does Ricardo say Portugal should not make both goods?
How does comparative advantage apply to personal finance?
Does comparative advantage mean free trade is always good?
What does comparative advantage say about AI taking jobs?
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.