If you’ve ever sold an asset like stock or real estate, it’s likely that you’ve had to report your cost basis for that asset when you filed your taxes. There are many factors that contribute to determining your cost basis, including the investment vehicle, the calculation method and how you acquired your asset. According to the IRS, it’s up to you, the taxpayer, to accurately report your cost basis when you file your taxes, so it’s important to have a basic understanding of how it works in order to maximize your tax benefits.
What is cost basis?
Cost basis is the amount you paid to purchase an asset. When you invest in a stock, mutual fund or real estate, your cost basis is the price (or cost) of the asset on the day you bought it. Keeping track of your cost basis can help you determine your potential profit or loss should you decide to sell your asset.
Why is cost basis important?
Understanding the cost basis for your investments is important for tax purposes. Generally, selling an asset and realizing a profit or loss on that investment is considered a taxable event. In order to fully understand the tax consequences for the sale of an asset, you’ll need to know the original cost basis.
When to track cost basis
Buying and selling equities (stocks or mutual funds) 
When you purchase equities such as stocks or mutual funds, the cost basis is usually equal to the price you paid for each share, plus any commission fees to your broker. 
If you reinvest a dividend that is paid out to you, the cost basis is the price you paid for the new shares. 

If you receive additional shares as part of stock split, your original cost basis does not change. 

If you inherit assets, cost basis can be adjusted, or “stepped up,” to the date of death of the original asset holder. However, if you receive assets as a gift, your cost basis will be whatever the original owner paid when they purchased the asset. 

When you invest in real estate, the cost basis is generally the price you paid for the property, plus the cost of any capital improvements you made. 

If a company declares Chapter 7 bankruptcy, it ceases to exist, and any shares you owned in that company are likely worthless. However, if a company files Chapter 11, you may receive stock in the reorganized corporation. If that happens, your cost basis would carry over from your original purchase. 

If a company you own merges with another company, your total cost basis is typically unaffected. However, if you receive new shares as part of the merger, your cost basis per share may change. 
Ways to calculate cost basis
For equities such as stocks, mutual funds and exchangetraded funds, there are three primary methods investors use to calculate cost basis:
FIFO
The “first in, first out,” or FIFO, method for calculating cost basis works exactly how it sounds. This method usually applies if you bought shares of the same company at different times. When you sell shares, you would use the price of the first shares “in” as your basis.
For example, say you bought 10 shares of XYZ on Jan. 5, 2017, for $1,000 ($100 per share). On June 10 of the same year, XYZ was trading at $120 per share, and you decided to purchase 10 more shares for $1,200. If you decided to sell five shares today, using the FIFO method your cost basis would be $500, or the price you paid for the first shares of XYZ that you purchased.
Using the same example, let’s say you decided to sell 15 shares of XYZ. Using the FIFO method here, your cost basis for the first 10 shares would be the first shares that you purchased, or $1,000 (the first shares “in”). Your cost basis for the additional five shares would then be $120 per share, or $600. Adding everything together would give you a cost basis of $1,600 for all 15 shares that were sold.
Average cost
The average cost method for determining cost basis is most commonly used for mutual funds. To calculate your basis, the average cost method takes the cost of all the shares you have purchased and divides it by the number of shares. Using the example above, if you purchased 10 shares of XYZ for $100 each and then 10 more shares for $120 each, your cost basis would be the total cost ($2,200) divided by the total number of shares (20 shares), or $110 per share.
Specific shares
The specific shares method allows you to select which shares to sell. This method can be beneficial if you’re trying to limit the potential tax consequences of the sale. Using the example above, you could choose whether you wanted your cost basis to be $100 or $120 per share. This method allows for more flexibility, as you can choose which cost basis is more beneficial to you based on your tax situation.
Let’s say that since purchasing your 20 shares of XYZ, the price of that company’s stock has dropped significantly and you’d like to take advantage of some taxloss harvesting. In that case, you’d want to have the highest possible cost basis in order to maximize your capital loss. For instance, if you were going to sell 15 shares of XYZ, you could elect to include all 10 of the shares you bought for $120, and only 5 of the shares you bought for $100, giving you the highest possible cost basis. The total total cost basis for the 15 shares sold would be (10 x $120) + (5 x $100), or $1,700.
If you refer to the FIFO section above, the same sale of 15 shares resulted in a cost basis of $1,600, which is $100 less than the cost basis we got using the specific shares method. This is a good example of how investors can manipulate the different methods for calculating cost basis to their advantage.
Most brokerage firms will default to using the FIFO method if you don’t specify how you would like your cost basis calculated. You may benefit from a different method, but it really depends on your specific tax situation. Consult your accountant or tax advisor to determine which method might be best for you.
Examples of cost basis
Purchasing stocks
Typically, when you purchase shares of stock, the cost basis is simply the price you paid for each share.
Say you purchased 10 shares of XYZ for $100 per share in a taxable brokerage account. The total cost would be $1,000, and your cost basis for each individual share would be $100. A year later, XYZ stock is trading at $150 per share, and you decide to sell five shares. To calculate your profits for tax purposes, you’ll need to subtract your cost basis for the five shares from the sale price of the five shares.
($150 x 5) – ($100 x 5) = $250
The $250 profit from the sale would be considered your capital gain, and that’s what you would pay taxes on.
If you purchased shares through a broker and paid commissions, those costs would be added to your cost basis. So if you bought your 10 shares of XYZ from a broker for $100 per share, and you paid a 1% commission to place that trade, your cost basis would be $1,000 + (1% x $1,000), or $1,010.
» MORE: Here are some strategies to be more taxefficient with your investment accounts.
Mutual funds
The process for calculating cost basis for mutual fund shares is similar to that for stocks. When you purchase shares of a mutual fund, the cost basis is the price you paid per share of the fund.
Many mutual funds have upfront “load charges” that you can add to the cost basis. For example, if you purchased 10 shares of a fund at $100 per share and you paid a 5% load charge, your cost basis for the shares would be $1,000 + (5% x $1,000), or $1,050.
Dividends
If you own stock or mutual fund shares that pay you a dividend, and you reinvest that dividend to buy more shares, you’ll need to recalculate your cost basis for each group, or “lot,” of new shares you buy.
It might help to think about dividend reinvestment as if a company paid you cash directly, and you immediately took that cash and bought more shares of the same company. For example, say you invest in a mutual fund and have elected a dividend reinvestment plan, or DRP. The fund issues $1,000 in dividend payments to you. If those dividends are reinvested, buying you 10 additional shares, then your cost basis for each share would be $100.
Stock splits
If you own shares in a company that declares a split, your cost basis is spread across your new and old shares of that company. Say you own 100 shares of ABC, which you bought for $10 per share, giving you a cost basis of $1,000. If ABC declares a 2for1 stock split, you now own 200 shares of the company, but still have the same total cost basis of $1,000. That means your pershare cost basis goes down to $5.
Inheritance and gifts
When the owner of a taxable account passes away, the beneficiaries of the assets can sometimes take advantage of a cost basis “stepup.” For example, if 20 years ago you bought 2,000 shares of XYZ for $2 per share, you’d have a cost basis of $4,000. Fastforward to today and XYZ is trading for $200 per share, which means your 2,000 shares are now worth $400,000. If you decided to sell those shares, you’d realize a capital gain of $396,000 — which would result in a pretty hefty tax bill. If we assume a 15% capital gains tax rate, you would owe about ($396,000 x 15%) or $59,400 in capital gains taxes.
However, if you kept those shares and passed them on to your spouse or children when you died, the cost basis would reset (or stepup) to the value of those shares on your date of death. Using the example above, let’s say you pass away when the XYZ shares are worth $400,000 total, and your spouse inherits those shares. Next year, the total value of the shares goes to $410,000 and he or she sells all the XYZ they own. Because their basis “steppedup” to $400,000 on the day you died, they would only owe taxes on $10,000 of growth. Assuming a 15% capital gains tax rate, your bereaved spouse owes ($10,000 x 15%), or $1,500 in capital gains taxes after the sale.
Alternatively, let’s say you decided to give those same shares to your children before your death. If you gifted the shares, your kids would have to use the cost basis from your original date of purchase, minus the annual gift tax exclusion of $15,000 per year.
Real estate
The cost basis for real estate is generally what you paid at the time of purchase. If you have made capital improvements to your home (that is, an addition or permanent structural change to a property that improves its value), you can add the cost of the improvements to your cost basis.
For example, you buy a house for $250,000 and pay the mortgage off over 20 years. While you own the house, you hire someone to install a deck, and it costs $10,000. The cost of the deck would be added to your original cost basis, making your adjusted cost basis $260,000. If you then sell the house for $310,000, your total gain on selling the property would be $50,000 (the sale price minus your adjusted cost basis).
If you receive real estate as a gift, the rules above for gifts would apply.
The examples listed in this article are fairly straightforward, but calculating cost basis can be complicated. In order to make sure you’re maximizing your tax benefits, consider speaking with a financial advisor or tax advisor. They’ll be able to assess your individual situation to make sure you’re being as efficient as possible from a tax perspective.