# Who has the comparative advantage?

Finds which of two producers has the comparative and the absolute advantage in each of two goods, from output or input per unit, with each opportunity cost.

- Page: https://www.acalculator.org/finance/comparative-advantage-calculator
- JSON spec: https://www.acalculator.org/finance/comparative-advantage-calculator.json
- Version: bb0daca73222

## Default answer

Example with the default inputs (Numbers are Output, Producer A Saudi Arabia, Producer B United States, Good 1 oil, Good 2 corn, A: good 1 100, A: good 2 25, B: good 1 50, B: good 2 100): Comparative advantage: Saudi Arabia in oil; United States in corn.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| basis | Numbers are | Output each producer makes with the same resources, or the resources (hours, workers) each needs per unit. |
| na | Producer A | The first producer: a country, a firm or a person. |
| nb | Producer B | The second producer. |
| g1 | Good 1 | The first good. |
| g2 | Good 2 | The second good. |
| a1 | A: good 1 | Output with the same resources, or resources needed per unit, as chosen above. |
| a2 | A: good 2 | Output with the same resources, or resources needed per unit, as chosen above. |
| b1 | B: good 1 | Output with the same resources, or resources needed per unit, as chosen above. |
| b2 | B: good 2 | Output with the same resources, or resources needed per unit, as chosen above. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| comparative1 | Comparative advantage in good 1 | The producer with the lower opportunity cost of good 1. |
| comparative2 | Comparative advantage in good 2 | The producer with the lower opportunity cost of good 2. |
| absolute1 | Absolute advantage in good 1 | The producer that makes more of good 1 with the same resources. |
| absolute2 | Absolute advantage in good 2 | The producer that makes more of good 2 with the same resources. |
| summary | Comparative advantage | Who has the comparative advantage in each good, by name. |
| costA1 | A: cost of 1 unit of good 1 | Units of good 2 that A gives up to make one unit of good 1. |
| costB1 | B: cost of 1 unit of good 1 | Units of good 2 that B gives up to make one unit of good 1. |
| costA2 | A: cost of 1 unit of good 2 | Units of good 1 that A gives up to make one unit of good 2. |
| costB2 | B: cost of 1 unit of good 2 | Units of good 1 that B gives up to make one unit of good 2. |

## Method

Output mode: A’s cost of good 1 = A₂ ÷ A₁ (units of good 2), of good 2 = A₁ ÷ A₂; the same for B. Input mode: output = 1 ÷ input first. Comparative advantage: the lower cost. Absolute advantage: the higher output (fewer inputs).

## Assumptions

- Each producer has the same resources (such as 100 worker hours), and costs per unit stay the same at any output.
- Two producers, two goods.

## Worked examples

1. basis = output, na = Saudi Arabia, nb = United States, g1 = oil, g2 = corn, a1 = 100, a2 = 25, b1 = 50, b2 = 100 gives comparative1 = Saudi Arabia, comparative2 = United States, absolute1 = Saudi Arabia, absolute2 = United States, costA1 = 0.25, costB1 = 2, costA2 = 4, costB2 = 0.5, summary = Saudi Arabia in oil; United States in corn. Source: https://openstax.org/books/principles-economics-3e/pages/33-1-absolute-and-comparative-advantage.
2. basis = input, na = United States, nb = Mexico, g1 = shoes, g2 = refrigerators, a1 = 4, a2 = 1, b1 = 5, b2 = 4 gives comparative1 = Mexico, comparative2 = United States, absolute1 = United States, absolute2 = United States, costA1 = 4, costB1 = 1.25, costA2 = 0.25, costB2 = 0.8, summary = Mexico in shoes; United States in refrigerators. Source: https://openstax.org/books/principles-economics-3e/pages/33-2-what-happens-when-a-country-has-an-absolute-advantage-in-all-goods.
3. basis = output, a1 = 10, a2 = 20, b1 = 5, b2 = 10 gives comparative1 = Neither (equal), comparative2 = Neither (equal), absolute1 = A, costA1 = 2, costB1 = 2. Source: https://openstax.org/books/principles-economics-3e/pages/33-1-absolute-and-comparative-advantage.

## FAQ

### How do I calculate comparative advantage?

Work out each producer’s opportunity cost of a good: how much of the other good it gives up to make one unit. With 100 worker hours, Saudi Arabia makes 100 barrels of oil or 25 bushels of corn, so a barrel costs 25 ÷ 100 = ¼ bushel. The US makes 50 barrels or 100 bushels, so a barrel costs 2 bushels. Saudi Arabia’s cost is lower: it has the comparative advantage in oil.

### What is the difference between absolute and comparative advantage?

Absolute advantage means making more of a good with the same resources (or using fewer resources per unit). Comparative advantage means making it at a lower opportunity cost. A producer can have the absolute advantage in both goods but the comparative advantage in only one.

### Can a country have a comparative advantage in both goods?

No. A producer’s opportunity cost of one good is the reciprocal of its cost of the other, so if its cost of good 1 is lower, its cost of good 2 must be higher. When the costs are equal, neither has a comparative advantage, and trade gives no gain.

### What if my numbers are hours or workers per unit?

Choose “Input per unit”. The page turns each into output per unit of resource (1 ÷ input) first. In OpenStax’s example, the US needs 4 workers per 1,000 shoes and 1 per 1,000 refrigerators, so a pair of shoes costs it 4 refrigerators.

### What are the terms of trade?

The price at which the goods are traded, in units of one good per unit of the other. Both producers gain when it lies between their two opportunity costs; with oil, between ¼ and 2 bushels of corn per barrel.

### Why does comparative advantage matter?

David Ricardo argued in 1817 that if each producer specializes in the good with the lower opportunity cost and they trade, both can end up with more of both goods than they could make alone.

## Sources

- OpenStax. Principles of Economics 3e, §33.1 Absolute and Comparative Advantage (Tables 33.1, 33.2 and 33.4, oil and corn), retrieved 2026-10-18. https://openstax.org/books/principles-economics-3e/pages/33-1-absolute-and-comparative-advantage
- OpenStax. Principles of Economics 3e, §33.2 What Happens When a Country Has an Absolute Advantage in All Goods (Table 33.7, shoes and refrigerators), retrieved 2026-10-18. https://openstax.org/books/principles-economics-3e/pages/33-2-what-happens-when-a-country-has-an-absolute-advantage-in-all-goods
