Even if one country is worse at making everything, trade still makes both better off. Ricardo's counterintuitive result, made visible.
Comparative AdvantageLive
the gains from trade
Controls
Presets
David Ricardo's great insight: even if one country is worse at making everything, both still gain from trade. Each should specialize in the good it gives up the least to produce — its comparative advantage — measured by the slope of its production-possibility frontier. Trade then lets both consume beyond their own frontiers.
Reading this result: Country A gives up 0.50 cloth per wine versus B at 2.00, so A specializes in wine and B in cloth — trade then lets both consume beyond their own frontiers.
Runs locally in your browser — free forever. Scale to the cloud when reality gets heavy.
★ Sign in to save this setupSave your tuned setup, or drop this simulation into your own site, docs, or course page.
How it works
Comparative advantage compares opportunity costs, not raw productivity. Each country should specialize in the good it sacrifices the least to produce — the flatter or steeper slope of its production-possibility frontier. Trading at a price between the two opportunity costs lets both countries consume beyond their own frontiers. It is the foundation of international trade theory.
✦
Ask the AI about this model
The math, the assumptions, real-world uses, or a code translation — explained for this exact simulation.
Is this comparative advantage gains from trade tool really free?▾
Yes. Comparative Advantage runs entirely in your browser using your device's own compute, so local use is free forever. You only pay Compute Tokens if you scale a job to the cloud.
Do I need to install anything?▾
No. Everything runs client-side in a modern browser — no downloads, no license, no account required to start.
Can I save or share my simulation?▾
Create a free account to save projects, and use a shareable embed or minted DOI to publish a live, interactive version anywhere.
How accurate are the results?▾
The solver uses established numerical methods, but results are for research and educational purposes and should be validated against experiment or professional review before you rely on them.