Opportunity cost formula: How to calculate with examples

- What is opportunity cost?
- The opportunity cost formula
- How do you calculate opportunity cost?
- Types of costs in an opportunity cost calculation
- Opportunity cost vs. sunk cost
- Opportunity cost vs. risk
- Opportunity cost examples
- Forecasting and projected returns
- Capital budgeting tools like NPV and IRR
- Why opportunity cost matters in decision-making
- Track opportunity costs in real time with Ramp

Every resource allocation decision you make has a hidden price tag: the value of the option you didn't choose. Opportunity cost makes that price visible, showing you what you're really giving up, not just what you're paying, so you can allocate limited resources more effectively.
This guide breaks down the opportunity cost formula, walks through how to calculate it step by step, and compares it to related concepts like sunk cost and risk.
What is opportunity cost?
Opportunity cost is the potential benefit you lose out on when you choose one option over another. For example, if you're a small business owner who can either invest in new equipment or expand your marketing efforts, the opportunity cost of purchasing equipment is the potential returns you'd have gained from increased sales through the marketing campaign.
Opportunity cost helps you evaluate trade-offs that are fundamental to business decision-making.
The opportunity cost formula
The opportunity cost formula is the return of your best forgone option minus the return of your chosen option.
Opportunity cost = Return on best forgone option − Return on chosen option
This formula lets you compare the potential returns from two different options, showing you what you give up by choosing one path over another.
Example: Say you're choosing between two options for your business:
- Option A: Invest in new equipment expected to increase efficiency, with a projected return on investment (ROI) of $10,000
- Option B: Invest in marketing that could increase sales, with a potential return of $15,000
Opportunity cost = $15,000 (Option b) − $10,000 (Option a) = $5,000
The opportunity cost of choosing new equipment is $5,000, the potential benefit from the marketing investment you didn't choose.
How do you calculate opportunity cost?
Calculating opportunity cost is a five-step process you can apply with your own numbers. Here's a scenario to follow along: a company has $500,000 to invest and is deciding between hiring sales reps, projected to return $800,000, or increasing marketing spend, projected to return $600,000.
1. List your available options
Identify the mutually exclusive choices on the table. In this case, that's hiring sales reps or increasing the marketing budget with the same $500,000.
2. Estimate the return of each option
Assign each option its expected return. Returns can be revenue, cost savings, or time saved, not just cash: hiring reps is projected to return $800,000, and marketing is projected to return $600,000.
3. Apply the opportunity cost formula
Subtract the chosen option's return from the best forgone option's return. If you choose marketing, the opportunity cost is:
$800,000 − $600,000 = $200,000
4. Weigh risk and time frame
Adjust for uncertainty and payoff timing before you decide. A higher-risk or slower-payback option raises the real opportunity cost, even if its projected return looks larger on paper.
5. Choose and document your decision
Pick the option with the best risk-adjusted net benefit. Record your reasoning so the trade-off is auditable later, especially if the outcome doesn't match the projection.
Types of costs in an opportunity cost calculation
Calculating opportunity cost accurately means accounting for three types of costs. Each behaves differently in your decision, so it's worth breaking them out individually.
Explicit costs
Explicit costs are the direct, out-of-pocket costs you can easily measure, like wages, rent, purchasing new equipment, and other business expenses. These are the costs that show up on an invoice or a bank statement, which makes them the easiest input in an opportunity cost calculation.
Implicit costs
Implicit costs are harder to measure but still critical. The time you spend managing a project could have gone toward another income-generating opportunity, and a founder who works unpaid in their own business is giving up the salary they'd earn elsewhere. That forgone salary is a real implicit cost, even though no cash changes hands.
Sunk costs
Sunk costs are money you've already spent and can't recover, like $5,000 sunk into accounting software that didn't work out. Always ignore sunk costs when calculating opportunity cost. You can't recover them, so they shouldn't influence future decision-making.
Opportunity cost vs. sunk cost
Sunk cost and opportunity cost look similar but point in opposite directions. Sunk cost is money you've already spent and can't get back; opportunity cost is the value of the next-best alternative you give up going forward. If you've already bought 1,000 shares for $10,000, that spend is sunk. The opportunity cost is the return you forgo by not putting that same $10,000 into your next-best investment instead.
| Dimension | Opportunity cost | Sunk cost |
|---|---|---|
| Timing | Forward-looking | Backward-looking |
| Recoverability | N/A, it's a forgone benefit | Unrecoverable once spent |
| Role in decisions | Should influence your next choice | Should be ignored |
Opportunity cost vs. risk
Risk and opportunity cost are related but distinct. Risk is the chance that an outcome differs from what you projected; opportunity cost is the value of the best alternative you didn't choose. The two interact: higher uncertainty raises the effective opportunity cost of committing to a choice.
Consider a logistics company weighing entry into a market with an unstable regulatory environment. A policy shift could cut a projected $2,000,000 annual return in half, which raises the real opportunity cost of choosing that market over a more stable, lower-upside alternative.
Opportunity cost examples
Opportunity cost gets clearer when you apply it to real situations. The examples below cover the most common decision types finance teams encounter, from capital allocation to investment evaluation.
Choosing between investments
Imagine you own a small business and have to decide whether to invest in automation or expand your product line. By calculating the opportunity cost, you can weigh the trade-offs and choose the option that maximizes your expected returns.
| Option | Investment | Expected ROI | Opportunity Cost |
|---|---|---|---|
| A | Automation | $12,000 | $6,000 (the potential returns from expanding the product line) |
| B | Product Line Expansion | $18,000 | - |
In this scenario, the opportunity cost of choosing automation is $6,000—the potential returns you give up by not expanding the product line.
Opportunity cost in business decisions
For businesses, opportunity cost plays a critical role in decisions that involve capital allocation and resource management. Every business decision, from choosing between new equipment or marketing, to deciding on inventory management, involves trade-offs.
By considering opportunity cost, you can make smarter decisions, ensure optimal resource allocation, and maintain a positive cash flow for your business. This can involve comparing the rate of return from different investments and aligning decisions with long-term goals.
The role of opportunity cost in investment decisions
Opportunity cost helps investors evaluate potential returns across multiple options. If a business is deciding between purchasing new equipment or expanding operations, the opportunity cost is the projected return it forgoes from the option it doesn't choose.
This is also where accounting profit and economic profit diverge, a distinction worth naming since both terms get used loosely in finance conversations. Accounting profit only subtracts your explicit costs, while economic profit subtracts opportunity cost, too, giving you a fuller picture of whether a decision actually paid off.
Suppose you're comparing two investment opportunities for your business:
| Option | Investment | Expected ROI | Opportunity cost |
|---|---|---|---|
| A | New equipment | 8% | 4% (the additional return you could have gained from expanding operations) |
| B | Expansion | 12% | - |
By choosing Option A, the opportunity cost is the potential 4% additional return you give up by not choosing Option B. Tying that back to economic profit, Option A's economic profit is lower than its accounting profit suggests once you factor in the return you left on the table.
Forecasting and projected returns
Forecasting helps you predict the projected returns of your investment options. By factoring in opportunity cost, you can forecast the economic profit of different strategies and optimize their financial outcomes.
For example, if you're deciding whether to automate a workflow now or delay 6 months, pair opportunity cost with a rolling 12-month forecast that compares the projected economic profit of each path. Delaying automation forgoes the sales or efficiency gains you'd have captured in those 6 months, and a forecast makes that trade-off visible before you commit spend.
Capital budgeting tools like NPV and IRR
When making long-term investment decisions, businesses often use capital budgeting techniques like Net Present Value (NPV) and Internal Rate of Return (IRR) to evaluate potential projects. These methods compare the present value of expected future cash flows against the cost of the investment. Keeping cash flow management aligned with sustained profitability supports long-term growth.
- Net Present Value (NPV): The sum of the present values of future cash flows minus the initial investment. NPV helps you determine whether an investment is likely to generate positive returns.
- Internal Rate of Return (IRR): The discount rate that makes the NPV of an investment equal to zero. It's used to evaluate the profitability of potential investments.
The discount rate you use in an NPV calculation is itself an opportunity cost: it represents the return available on the next-best comparable investment. Incorporating opportunity cost into these methods means you compare not just the absolute benefits of an investment, but also the potential benefits it misses out on by choosing one investment over another.
Why opportunity cost matters in decision-making
Considering opportunity cost helps you avoid suboptimal choices. When you understand the trade-offs behind a decision, you can better allocate your resources to maximize your return on investment and your economic profit.
In business finance, skipping opportunity cost can lead to missed opportunities, poor resource management, and lower returns. Companies that use Ramp save an average of 5% a year across all spending and grow 3.2x faster than the average American business, evidence that consistently weighing trade-offs compounds over time. Factoring opportunity cost into every decision helps ensure your choices align with your financial goals and drive long-term success.
Track opportunity costs in real time with Ramp
Opportunity cost is invisible in most accounting systems—you see what you spent, but not what you gave up by spending it there. Ramp's accounting automation software surfaces the data you need to quantify these trade-offs and make smarter resource allocation decisions across your business.
Ramp gives you complete visibility into spending patterns, budget utilization, and resource allocation in real time. You can track spend by department, project, vendor, or custom dimension, then compare actual usage against budgets to identify where resources are tied up versus where they could create more value. When you see that one team is consistently underspending while another is overspending, you can reallocate resources before the quarter ends.
Here's how Ramp helps you quantify opportunity cost:
- Real-time spend tracking: Monitor expenses as they happen across all departments and projects, so you can spot misallocated resources immediately instead of discovering them at month-end.
- Custom reporting and analytics: Build reports that surface spending patterns, vendor concentration, and resource allocation trends so you can model alternative scenarios and calculate the true cost of current decisions.
- Automated categorization: Ramp's Accounting Agent auto-codes every transaction automatically across all required fields, giving you accurate data to analyze trade-offs without manual cleanup.
Try an interactive demo to see how Ramp's spend management platform helps finance teams make data-driven resource allocation decisions.

FAQs
Subtract the return of the option you chose from the return of the best option you gave up. If new equipment returns $10,000 and marketing would have returned $15,000, your opportunity cost is $5,000.
Divide total opportunity cost by the number of units involved: Per Unit Opportunity Cost = Total Opportunity Cost / Number of Units.
Yes. It applies any time you choose one option over another, like spending on current needs versus saving for the future.
Opportunity cost is the value of the option you didn't choose. Economic profit is your accounting profit minus that opportunity cost.
“I assumed I would have to choose between speed and control. What I found is that you can have both. A well-designed system takes friction out, for the finance function and for everyone else.”
Justin Webster
CFO, Denver Broncos

“A well-run district should not have to choose between getting work done at the school site and keeping control of the dollars behind it. We're not hiring more people to do more jobs, so we have to be smarter about the process. With Ramp, the purchase, the receipt, and the record stay together from the start. ”
Nick Brizeno
Director of Purchasing, San Marcos Unified School District

“AI is moving faster than the finance context around it. Prices change, models change, and the value is not always obvious from an invoice. We needed enough detail to know which bets deserved more investment — and which ones did not.”
Greg Cooley
Controller, AngelList

“Invoices, cards, tokens. The categories change but the principle doesn't: know where the money is going, remove the work around it, and make sure the spend is worth it.”
Maciej Mylik. Finance
ElevenLabs

“There's just no surprises anymore. No more waiting two months to find out how a job did. We know how it's doing as it's happening.”
Erich Kuss
Financial Systems Manager, Infinity Home Services

“More token spend isn’t proof that AI is working. Less isn’t proof that it isn’t. What matters is whether we’re buying the right level of intelligence for the work. Ramp lets us make that judgment in the same place we manage every other type of spend.”
Cody Nutt
Senior Director of Business Systems, Daxko

“Most banks treat the back office as a cost to keep down. We treat ours as a return to compound, which is why we run it on Ramp. Now we put our clients on Ramp, too.”
Patrick Gaughen
President & COO, Hingham Institution for Savings

“Browserbase builds infrastructure so AI agents can do real work. Ramp is doing the same for finance. It’s not another tool. It’s a system purpose-built for AI-driven finance, and that’s why we chose Ramp as our financial operating system from day one.”
Paul Klein IV
Founder & CEO, Browserbase


