Macroeconomics

Comparative Advantage Calculator

Enter each producer's output of two goods to compare their opportunity costs.

  • Free
  • No sign-up
  • Updated for 2026

Outputs by producer

Enter the outputs to see the opportunity costs.

Worked example

With these example inputs:

  • Country A: good 1 output10
  • Country A: good 2 output20
  • Country B: good 1 output5
  • Country B: good 2 output30

A: opportunity cost of good 1: 2

  • A: opp. cost of good 12
  • B: opp. cost of good 16

Add this calculator to your site

Free to embed. Copy the snippet below, it drops the live calculator straight into any page.

What comparative advantage means

Comparative advantage shows who should make what. It compares the opportunity cost of two producers. You enter each one's output of two goods. The tool finds the cost of one good in terms of the other. The producer with the lower cost has the edge. That edge guides smart trade.

Why opportunity cost is the key

To make more of one good, you make less of another. That trade-off is the opportunity cost. It is not about who is faster overall. It is about what each side gives up. The lower giver-up should specialise.

How to use this calculator

Enter four numbers. Put in Country A output for good one and good two. Then put in Country B output for both goods. The tool computes each opportunity cost. It shows the cost of good one for each side.

How it is calculated

The method is a simple ratio. Opportunity cost of good 1 = good 2 output / good 1 output. You divide one output by the other. The answer is in units of the other good. There is no money in this measure. It is a pure trade-off.

A worked example

Country A makes ten of good one and twenty of good two. Its opportunity cost of good one is two. Country B makes five of good one and thirty of good two. Its cost of good one is six. So A gives up less to make good one.

Reading the result

A lower number means a cheaper trade-off. Here A pays two units of good two per good one. B pays six for the same good one. So A holds the comparative advantage in good one. B then holds it in good two.

Who should produce what

Each side should make the good it gives up least for. A should focus on good one. B should focus on good two. Then they trade for the rest. Both can end up with more this way.

Common mistakes to avoid

One slip is picking the bigger producer as best. Size is not the same as low opportunity cost. Another is comparing the wrong goods. People also flip the ratio by mistake. Keep outputs in the right place for a true result.

The limits of this tool

This calculator uses two goods and two producers. The real world has many of both. It assumes output trades at a steady rate. It also ignores transport and other costs. Use it to learn the idea, not to set policy.

Comparative versus absolute advantage

Absolute advantage means making more with the same effort. Comparative advantage is about lower opportunity cost. A side can lead in both goods outright. Yet trade still pays if costs differ. That insight is the heart of the idea.

A final tip

Test a few output mixes to feel the effect. Watch how the lower cost shifts the advantage. Pair it with real costs before you act. A clear trade-off keeps the logic honest.

Frequently asked questions

How is comparative advantage found?

Compare the opportunity cost of a good for each producer, measured in units of the other good given up. If A gives up 2 units of good 2 per good 1 and B gives up 6, A has the advantage in good 1.

What does the result tell me?

The producer with the lower opportunity cost for a good should specialise in it. Comparing the two figures shows who should make good 1 and who should make good 2.