Calculate the true cost of your decisions by quantifying what you give up when choosing one option over another. Make every decision with full awareness of its real price.
Opportunity Cost Calculator is a practical tool that helps you think beyond the obvious costs of any decision. Every choice has a hidden price: the value of the best alternative you did not choose. This concept, fundamental to economics and investing, is chronically underweighted in everyday decision-making.
Warren Buffett has said that the cost of any investment is the next best thing you could have done with that money. This tool operationalizes that wisdom, making it easy to quantify opportunity costs for financial decisions, time allocation, career choices, and more. For a deeper understanding of how top investors think about opportunity cost and other foundational principles, explore KeepRule's principles library.
- Financial Opportunity Cost: Compare investment alternatives with compound growth projections
- Time Opportunity Cost: Quantify the value of time spent on different activities
- Career Path Analyzer: Compare lifetime earnings and satisfaction across career options
- Project Prioritization: Score projects by opportunity cost to find optimal allocation
- Sunk Cost Separator: Distinguish sunk costs from opportunity costs in analysis
- Visualization Dashboard: Charts showing opportunity cost over time horizons
- What-If Scenarios: Run alternative scenario comparisons
npm install -g opportunity-cost-calculatorOr clone:
git clone https://github.com/henu-wang/opportunity-cost-calculator.git
cd opportunity-cost-calculator
npm install && npm start# Compare two investment options
occ compare \
--option1 "S&P 500 Index Fund" --return1 0.10 --amount 50000 \
--option2 "Savings Account" --return2 0.04 --amount 50000 \
--years 20
# Output: Over 20 years, choosing Option 2 over Option 1 costs you $186,742const { OpportunityCost } = require('opportunity-cost-calculator');
const calc = new OpportunityCost();
calc.addOption({
name: "Growth Stock Portfolio",
expectedReturn: 0.12,
risk: "high",
initialInvestment: 100000
});
calc.addOption({
name: "Bond Portfolio",
expectedReturn: 0.05,
risk: "low",
initialInvestment: 100000
});
calc.addOption({
name: "Real Estate Rental",
expectedReturn: 0.08,
risk: "medium",
initialInvestment: 100000
});
const analysis = calc.analyze({ timeHorizon: 30 });
analysis.printReport();
analysis.visualize();# Compare spending 10 hours/week on different activities
occ time-compare \
--activity1 "Side business" --hourly-value 75 --hours 10 \
--activity2 "Online courses" --future-value-increase 0.15 --hours 10 \
--activity3 "Overtime at job" --hourly-value 50 --hours 10 \
--weeks 52The concept of opportunity cost is central to how great investors allocate capital. To see how masters like Buffett and Munger evaluate trade-offs across their investment decisions, visit KeepRule's masters page.
The calculator guides you through a structured process:
- Enumerate Options: List all realistic alternatives
- Quantify Returns: Estimate expected value for each option
- Assess Risk: Factor in probability-weighted outcomes
- Calculate Delta: Determine the cost of choosing each option over the best alternative
- Consider Intangibles: Account for non-financial factors
- Decide and Document: Record your reasoning for future review
For real-world scenarios demonstrating how opportunity cost analysis shapes investment decisions, check out KeepRule's scenario library.
| Analysis Type | Inputs | Output |
|---|---|---|
| Investment | Returns, risk, time horizon | NPV comparison, opportunity cost curve |
| Time | Activities, hourly values | Annual opportunity cost breakdown |
| Career | Salary trajectories, satisfaction | Lifetime value comparison |
| Project | ROI estimates, resource needs | Priority-ranked project list |
{
"currency": "USD",
"inflationRate": 0.03,
"discountRate": 0.07,
"defaultTimeHorizon": 10,
"riskFreeRate": 0.04,
"outputFormat": "detailed"
}Read more about opportunity cost thinking and other decision-making concepts on the KeepRule blog.
Pull requests are welcome! Please include tests for any new analysis types.
MIT License - see LICENSE for details.