Cost Basis: How It Works, Calculation and Examples

Cost basis is the original purchase price of an asset. Understanding cost basis and how to track it is important for tax-efficient investing.

Many, or all, of the products featured on this page are from our advertising partners who compensate us when you take certain actions on our website or click to take an action on their website. However, this does not influence our evaluations. Our opinions are our own. Here is a list of our partners and here's how we make money.


The investing information provided on this page is for educational purposes only. NerdWallet, Inc. does not offer advisory or brokerage services, nor does it recommend or advise investors to buy or sell particular stocks, securities or other investments.

Updated · 7 min read
Profile photo of Connor Emmert
Written by Connor Emmert
Writer
Profile photo of Chris Hutchison
Edited by Chris Hutchison
Lead Assigning Editor
Fact Checked

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 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, a 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.

Dividends

If you reinvest a dividend that is paid out to you, the cost basis is the price you paid for the new shares.

Stock splits

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

Inheritances and gifts

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.

Real estate

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.

How to calculate cost basis

For equities such as stocks, mutual funds and exchange-traded funds, there are three primary methods investors use to calculate cost basis: first in, first out (FIFO), average cost and specific shares.


FIFO


The first in, first out (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, 2024, 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 $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.

For example, 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 tax-loss 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 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. It can be worth talking to a CPA or tax advisor to determine which method might be best for you.

Nerdwallet advisors logo
Advertisement

1

Answer a few simple questions

2

Get a recommended match

3

Start achieving your money goals

What's your financial priority?

Financial Planning
Retirement Planning
Investment Management
Tax Strategy
Other

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.

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 paid a 1% commission to place that trade, your cost basis would be $1,000 + (1% x $1,000), or $1,010.


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 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 (DRIP). 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 stock split, your cost basis is spread across your new and old shares of that company. Say you own 100 shares of XYZ, which you bought for $10 per share, giving you a cost basis of $1,000. If XYZ declares a 2-for-1 stock split, you now own 200 shares of the company but still have the same total cost basis of $1,000. That means your per-share 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 “step-up.” 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. Fast-forward 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 $59,400 ($396,000 x 15%) 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 step-up) 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 they sell all the XYZ they own. Because their basis "stepped-up" 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 $1,500 ($10,000 x 15%) 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, plus or minus some potential adjustments.


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 a 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). Thankfully, many people can avoid paying capital gains taxes on their primary homes if their profit stays beneath a certain threshold.

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. 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 tax-efficient as possible.

MORE LIKE THISInvesting
Get more smart money moves – straight to your inbox
Sign up and we’ll send you Nerdy articles about the money topics that matter most to you along with other ways to help you get more from your money.
Nerdwallet advisors logo

Get matched to a financial advisor for free with NerdWallet Advisors Match.

Illustration
Advertisement