What Is Cost Basis?
Quick Answer
Your cost basis is the original price you paid for a stock, fund or other investment. It's used to calculate your gain or loss when you sell, as well as your potential tax bill.

When you sell an investment or a home, you may owe capital gains tax on the profit. Your cost basis is the original price you paid for the asset, and it's one of the key factors in figuring out how much you owe. Knowing how cost basis works and how to calculate it can help you plan ahead and avoid surprises at tax time.
What Is Cost Basis?
Your cost basis on an investment is the original price you paid for the shares of stock or other security you purchased. With a stock, that includes the price per share at the time of purchase plus any brokerage commissions or other transaction fees. With mutual funds, it also includes any upfront load fees.
With a home, cost basis works a bit differently. It starts with what you paid for the property, but you can also add certain costs over time, like major home improvements and money spent to repair damage.
When you sell, you subtract your cost basis from the sale proceeds to determine your gain or loss. That figure is then used to calculate any capital gains tax you may owe.
Invest Your Money Smarter
Browse top brokerages
Find a brokerage to start investing today. Compare offers with sign up bonuses and low or no fees.
Why Is Cost Basis Important?
Cost basis matters because it directly affects how much tax you owe when you sell an investment or a home. Without it, you can't accurately calculate your gain or loss on a sale.
If your cost basis is high relative to your sale price, your taxable gain is small. You may even have a loss, which can offset other gains.
On the flip side, if your cost basis is low, you may owe more in taxes. Tracking it carefully also protects you from overpaying. If you don't account for all eligible costs, you could end up reporting a larger gain than you actually had.
How to Calculate Cost Basis
The process for calculating cost basis differs, depending on whether you're dealing with investments or real estate.
Cost Basis for Investments
There are three main methods for calculating cost basis on investment securities:
- First-in, first-out (FIFO): The default method at most brokerage firms (except for mutual funds), FIFO assumes that when you sell a portion of your position, you're selling your oldest shares first. If those earlier shares had a lower purchase price, this can result in a larger taxable gain.
- Specific identification: This method lets you choose which shares to sell based on their individual cost basis. By selecting shares with a higher purchase price, you can reduce your taxable gain on the sale. You'll need to instruct your broker to use this method rather than the default.
- Average cost, single category: The default method for mutual fund shares, this approach averages the cost of all shares you own, then multiplies that average by the number of shares you're selling.
Cost Basis for a Home
To calculate the cost basis for real estate, you'll start by adding common costs like:
- The original purchase price of the home
- Eligible settlement fees and closing costs
- Major home improvements
- Costs to repair damage to the home and property
Then, you'll subtract certain expenses, such as:
- Allowable depreciation for business or rental purposes
- Casualty losses
- Insurance payments for casualty losses
- Energy credits and subsidies
Keep in mind, though, that the IRS provides an exclusion for capital gains tax for taxpayers who resided in the home for at least two out of the previous five years. More specifically, you may be able to exclude up to $250,000 in capital gains (or $500,000 if you're married and filing jointly).
Learn more: How to Sell Your House: A Step-by-Step Guide
Examples of Cost Basis
Depending on the type of asset you own, here are some examples of how you might calculate the cost basis.
FIFO Method vs. Specific Identification Method
Let's say you've purchased shares of ABC company in the following intervals:
- 10 shares at $10 per share
- 15 shares at $12 per share
- Five shares at $14 per share
The price has since jumped to $20, and you want to sell five shares, netting $100. Using FIFO, your cost basis would be $50 (five shares at $10), leaving you with a taxable gain of $50.
With specific identification, you could instruct your broker to sell the five shares you bought at $14 each, giving you a cost basis of $70 and a taxable gain of only $30.
Average Cost, Single Category Method
Let's say you've purchased 100 shares of a mutual fund at various times, with an average cost per share of $65. If you sell 20 shares at $75 each for $1,500, your cost basis is $1,300 (20 shares x $65 average). Your taxable gain would be $200.
Real Estate Method
Say you bought a home for $200,000 and later sold it for $300,000. Over the years, you spent $20,000 on improvements and repairs, but received $5,000 in insurance payouts for losses.
Your cost basis would be $215,000 ($200,000 + $20,000 - $5,000), leaving you with a gain of $85,000—well below the exclusion amount if you meet the residency requirements.
Frequently Asked Questions
The Bottom Line
Managing taxes on an investment portfolio or a home sale can be complicated, but understanding how to calculate your cost basis and gain can help you better estimate what your tax bill might look like.
If you're overwhelmed by the prospect of calculating cost basis on your own, consult with a tax professional who can provide personalized guidance for your situation.
What makes a good credit score?
Learn what it takes to achieve a good credit score. Review your FICO® Score for free and see what’s helping and hurting your score.
Get your FICO® ScoreNo credit card required
About the author
Ben Luthi has worked in financial planning, banking and auto finance, and writes about all aspects of money. His work has appeared in Time, Success, USA Today, Credit Karma, NerdWallet, Wirecutter and more.
Read more from Ben