Finance tools

Comparative advantage calculator — opportunity cost & specialization

Free comparative advantage calculator for international trade economics — not competitive advantage (business strategy) or revealed comparative advantage (export-share RCA). Enter output or input tables for two entities and two goods; get opportunity costs, who should specialize, feasible terms of trade, and CSV/PDF export.

What is comparative advantage?

Output vs input approach

  1. Output tables — Other Over

    When the table shows maximum output per fixed input (e.g. units per worker), opportunity cost of Good A = Good B output ÷ Good A output. Mnemonic: Other Over.

  2. Input tables — It Over

    When the table shows resources per unit (e.g. hours per cake), opportunity cost of Good A = Good A input ÷ Good B input. Mnemonic: It Over.

  3. Compare and specialize

    The entity with the lower opportunity cost for a good has comparative advantage in that good. Each entity should specialize where its opportunity cost is lowest.

Worked example: Country X and Country Y

Worked example: cakes and pies (input mode)

Terms of trade

Gains from trade

Limitations of the model

Assumptions

Not revealed comparative advantage (RCA)

RCA uses export data

Frequently asked questions about this comparative advantage calculator

How do you calculate comparative advantage?

Calculate the opportunity cost of each good for each entity, then compare. The entity with the lower opportunity cost for a good has comparative advantage in that good and should specialize there.

How do you calculate opportunity cost for comparative advantage?

Output tables: divide the other good by the target good (Other Over). Input tables: divide the target good's input by the other good's input (It Over). The calculator applies the correct formula for the mode you select.

How to calculate comparative advantage from a table?

Read each cell as output per worker or hours per unit. Pick the mode, enter four numbers, and compare opportunity costs row by row. Lower cost wins comparative advantage for that good.

What is the difference between absolute and comparative advantage?

Absolute advantage = more output with the same inputs. Comparative advantage = lower opportunity cost. One entity can lead on absolute advantage for both goods but still split comparative advantage across goods.

Can one country have comparative advantage in both goods?

In the standard two-good model, no. Opportunity costs are reciprocals — if you have the edge in Good A, the other entity has the edge in Good B (unless opportunity costs tie exactly).

What is the output vs input approach?

Output approach: numbers are units produced (PPC maxima, production tables). Input approach: numbers are resources per unit (hours, workers). Use the matching mode so you do not flip the ratio.

How do you find who should specialize?

Specialize in the good where your opportunity cost is lowest relative to the other entity. The calculator's specialization summary states this directly for both entities.

What are terms of trade?

The rate at which one good exchanges for another. Mutually beneficial terms fall between the two entities' opportunity costs for that good. The results panel shows the feasible range when costs differ.

How is revealed comparative advantage calculated?

RCA = (country's export share of a product) ÷ (world export share of that product). Values above 1 suggest export strength. That is not what this opportunity-cost calculator computes — use export statistics for RCA.

What are the limitations of comparative advantage theory?

The textbook model ignores transport costs, tariffs, economies of scale, unemployment, and changing technology. It is a teaching tool for relative efficiency, not a complete trade-policy model.

How does trade help if one country has absolute advantage in everything?

The more productive country still gives up different amounts of each good when it shifts production. Specializing by comparative advantage raises combined output so both sides can consume beyond their solo production possibilities.

What happens if opportunity costs are equal?

Equal opportunity costs mean no comparative advantage and no clear gains from specialization in the basic model. This calculator reports a tie rather than assigning a false winner.