In microeconomic theory, the opportunity cost, also known as alternative cost, is the value (not a benefit) of the choice of a best alternative cost while making a decision. A choice needs to be made between several mutually exclusive alternatives; assuming the best choice is made, it is the "cost" incurred by not enjoying the benefit that would have been had by taking the second best available choice. The New Oxford American Dictionary defines it as "the loss of potential gain from other alternatives when one alternative is chosen." Opportunity cost is a key concept in economics, and has been described as expressing "the basic relationship between scarcity and choice." The notion of opportunity cost plays a crucial part in attempts to ensure that scarce resources are used efficiently. Thus, opportunity costs are not restricted to monetary or financial costs: the real cost of output forgone, lost time, pleasure or any other benefit that provides utility should also be considered an opportunity cost.
The term was coined in 1914 by Austrian economist Friedrich von Wieser in his book Theorie der gesellschaftlichen Wirtschaft  (Theory of Social Economy). The idea had been anticipated by previous writers including Benjamin Franklin and Frédéric Bastiat. Franklin coined the phrase "Time is Money", and spelt out the associated opportunity cost reasoning in his "Advice to a Young Tradesman" (1746): "Remember that Time is Money. He that can earn Ten Shillings a Day by his Labour, and goes abroad, or sits idle one half of that Day, tho' he spends but Sixpence during his Diversion or Idleness, ought not to reckon That the only Expence; he has really spent or rather thrown away Five Shillings besides."
Bastiat's 1848 essay "What Is Seen and What Is Not Seen" used opportunity cost reasoning in his critique of the broken window fallacy, and of what he saw as spurious arguments for public expenditure.
Explicit costs are opportunity costs that involve direct monetary payment by producers. The explicit opportunity cost of the factors of production not already owned by a producer is the price that the producer has to pay for them. For instance, if a firm spends $100 on electrical power consumed, its explicit opportunity cost is $100. This cash expenditure represents a lost opportunity to purchase something else with the $100.
Implicit costs (also called implied, imputed or notional costs) are the opportunity costs that are not reflected in cash outflow but implied by the failure of the firm to allocate its existing (owned) resources, or factors of production to the best alternative use. For example: a manufacturer has previously purchased 1000 tons of steel and the machinery to produce a widget. The implicit part of the opportunity cost of producing the widget is the revenue lost by not selling the steel and not renting out the machinery instead of using it for production.
One example of opportunity cost is in the evaluation of "foreign" (to the US) buyers and their allocation of cash assets in real estate or other types of investment vehicles. With the recent downturn (circa June/July 2015) of the Chinese stock market, more and more Chinese investors from Hong Kong and Taiwan are turning to the United States as an alternative vessel for their investment dollars; the opportunity cost of leaving their money in the Chinese stock market or Chinese real estate market is too high relative to yields available in the US real estate market.
Note that opportunity cost is not the sum of the available alternatives when those alternatives are, in turn, mutually exclusive to each other. It is the next best alternative given up selecting the best option. The opportunity cost of a city's decision to build the hospital on its vacant land is the loss of the land for a sporting center, or the inability to use the land for a parking lot, or the money the city could have made by selling the land. Use for any one of those purposes precludes all the others.
If someone loses the opportunity to earn money, that is part of the opportunity cost. If someone chooses to spend money, that money could be used to purchase other goods and services so the spent money is part of the opportunity cost as well. Add the value of the next best alternatives and you have the total opportunity cost. If you miss work to go to a concert, your opportunity cost is the money you would have earned if you went to work plus the cost of the concert.
Tshilidzi Marwala and Evan Hurwitz in their book introduced the notion of rational opportunity cost. This is the opportunity forgone that offers the expected utility that is the same as that which a rational person would choose. A rational person chooses that option which maximizes utility. The possibility of this are cases where a number of options have the same utility values.