Credential Index

Education and certification signals, decoded.

12

Cost Basis: How It Works, How to Calculate and Examples

Back to libraryUnknown authorApr 1, 2026
Cost Basis: How It Works, How to Calculate and Examples

You’re our first priority.
Every time.

NerdWallet, Inc. is an independent publisher and comparison service, not an investment advisor. Its articles, interactive tools and other content are provided to you for free, as self-help tools and for informational purposes only. They are not intended to provide investment advice. NerdWallet does not and cannot guarantee the accuracy or applicability of any information in regard to your individual circumstances. Examples are hypothetical, and we encourage you to seek personalized advice from qualified professionals regarding specific investment issues. Our estimates are based on past market performance, and past performance is not a guarantee of future performance.

We believe everyone should be able to make financial decisions with confidence. And while our site doesn’t feature every company or financial product available on the market, we’re proud that the guidance we offer, the information we provide and the tools we create are objective, independent, straightforward — and free.

So how do we make money? Our partners compensate us. This may influence which products we review and write about (and where those products appear on the site), but it in no way affects our recommendations or advice, which are grounded in thousands of hours of research. Our partners cannot pay us to guarantee favorable reviews of their products or services. Here is a list of our partners.

Cost Basis: How It Works, How to Calculate and Examples

Cost basis is the original purchase price of an asset. Tracking cost basis is key to 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 · 6 min read

How is this page expert verified?

NerdWallet's content is fact-checked for accuracy, timeliness and relevance. It undergoes a thorough review process involving writers and editors to ensure the information is as clear and complete as possible.

More on our editorial rigor

Writer

Expertise Personal Finance investing retirement

Connor Emmert is a former NerdWallet writer and an authority on investing. Prior to joining NerdWallet, he spent several years as a licensed financial advisor with Bank of America/Merrill Lynch and Fisher Investments. He earned his bachelor's degree in English at Colby College.

Connor Emmert is a former NerdWallet writer and an authority on investing. Prior to joining NerdWallet, he spent several years as a licensed financial advisor with Bank of America/Merrill Lynch and Fisher Investments. He earned his bachelor's degree in English at Colby College.

Writer + more + more

Head of Content, New Verticals

11 years of experience

Chris Hutchison helped build NerdWallet's editorial operation and has directed coverage across banking, investing, taxes and insurance. He now leads a team exploring new verticals. Before joining NerdWallet, he was an editor and programmer at ESPN and an editor at the San Jose Mercury News.

Chris Hutchison helped build NerdWallet's editorial operation and has directed coverage across banking, investing, taxes and insurance. He now leads a team exploring new verticals. Before joining NerdWallet, he was an editor and programmer at ESPN and an editor at the San Jose Mercury News.

Head of Content, New Verticals + more + more

What is cost basis?

What is cost basis?

Cost basis is the amount paid to purchase an asset. There is more than one way to calculate cost basis. Knowing your cost basis can help determine the profit or loss on an asset sale, as well as any related tax bill.

Cost basis is the amount paid to purchase an asset. There is more than one way to calculate cost basis. Knowing your cost basis can help determine the profit or loss on an asset sale, as well as any related tax bill.

» MORE: See our picks for the best financial advisors

» MORE:  » MORE:  See our picks for the best financial advisors

Why is cost basis important?

Why is cost basis important?

Cost basis is important for tax purposes because selling an asset for a profit or loss is usually a taxable event. In order to fully understand how much tax you might owe, you’ll need to know your cost basis.

Cost basis is important for tax purposes because selling an asset for a profit or loss is usually a taxable event. In order to fully understand how much tax you might owe, you’ll need to know your cost basis.

» MORE: See the capital gains tax rates

» MORE: » MORE: See the capital gains tax rates

The more you earn, the more complex your taxes become. Learn the 10 traps to dodge.

GET THE FREE GUIDE

on NerdWallet Wealth Partners' site. For informational purposes only. NerdWallet Wealth Partners does not provide tax or legal advice.

on NerdWallet Wealth Partners' site. For informational purposes only. NerdWallet Wealth Partners does not provide tax or legal advice.

When to track cost basis

When to track cost basis

Buying and selling equities (stocks or mutual funds)

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.

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

Dividends

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

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

Stock splits

Stock splits

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

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

Inheritances and gifts

Inheritances and gifts

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

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

Real estate

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.

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

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.

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 method

FIFO method

The first in, first out (FIFO) method for calculating cost basis usually applies if you bought shares of the same company at different times. When you sell shares, you use the price of the first shares “in” as your basis.

The first in, first out (FIFO) method for calculating cost basis usually applies if you bought shares of the same company at different times. When you sell shares, you use the price of the first shares “in” as your basis.

For example, say you bought 10 shares of XYZ on Jan. 5, 2025, for $1,000 ($100 per share).

For example, say you bought 10 shares of XYZ on Jan. 5, 2025, 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.

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.

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 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”).

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.

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.

Adding everything together would give you a cost basis of $1,600 for all 15 shares that were sold.

» Need more help? Learn how to choose a financial advisor

» Need more help?  » Need more help?  Learn how to choose a financial advisor

Average cost method

Average cost method

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 purchased and divides it by the number of shares.

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

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.

» Dive deeper: Strategies for tax-efficient investing

» Dive deeper: » Dive deeper: Strategies for tax-efficient investing

Specific shares method

Specific shares method

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.

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 want 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.

Using the example above, you could choose whether you want 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 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 five 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.

Let's say that since purchasing your 20 shares of XYZ, the price of that company's stock 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 five 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 using the specific shares method. This is a good example of how investors can use the different methods for calculating cost basis to their advantage.

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 using the specific shares method. This is a good example of how investors can use the different methods for calculating cost basis to their advantage.

Most brokerage firms default to 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 financial advisor or CPA to determine which method might be best for you.

Most brokerage firms default to 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 financial advisor or CPA to determine which method might be best for you.

The more you earn, the more complex your taxes become. Learn the 10 traps to dodge.

GET THE FREE GUIDE

on NerdWallet Wealth Partners' site. For informational purposes only. NerdWallet Wealth Partners does not provide tax or legal advice.

on NerdWallet Wealth Partners' site. For informational purposes only. NerdWallet Wealth Partners does not provide tax or legal advice.

Examples of cost basis

Examples of cost basis

Purchasing stocks

Purchasing stocks

Typically, when you purchase shares of stock, the cost basis is simply the price you paid for each share.

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 share would be $100.

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 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, subtract your cost basis for the five shares from the sale price of the five shares.

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, subtract your cost basis for the five shares from the sale price of the five shares.

($150 x 5) - ($100 x 5) = $250.

($150 x 5) - ($100 x 5) = $250.

The $250 profit is your capital gain.

The $250 profit is your capital gain.

If you purchased shares through a broker and paid commissions, those costs increase 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.

If you purchased shares through a broker and paid commissions, those costs increase 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.

» MORE: How taxes on stocks work

» MORE: How taxes on stocks work » MORE: How taxes on stocks work

Mutual funds

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.

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 add to the cost basis. For example, if you purchased 10 shares of a fund at $100 per share and paid a 5% load, your cost basis would be $1,000 + (5% x $1,000), or $1,050.

Many mutual funds have upfront “load charges” that you add to the cost basis. For example, if you purchased 10 shares of a fund at $100 per share and paid a 5% load, your cost basis would be $1,000 + (5% x $1,000), or $1,050.

» MORE: What are low-cost target date funds?

» MORE: » MORE: What are low-cost target date funds?

Dividends

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.

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 used that cash to buy more shares of the same company.

It might help to think about dividend reinvestment as if a company paid you cash directly and you immediately used that cash to buy more shares of the same company.

For example, say you invest in a mutual fund and 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.

For example, say you invest in a mutual fund and 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

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.

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

Inheritance and gifts

When the owner of a taxable account passes away, the beneficiaries of the assets can sometimes get a "step-up" in cost basis.

When the owner of a taxable account passes away, the beneficiaries of the assets can sometimes get a "step-up" in cost basis.

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.

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.

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.

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.

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

Alternatively, let’s say you 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.

» MORE: What to do with an inheritance

» MORE: » MORE: What to do with an inheritance

Real estate

Real estate

The cost basis for real estate is generally what you paid at the time of purchase. If you 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.

The cost basis for real estate is generally what you paid at the time of purchase. If you 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.

» MORE: How real estate investment trusts (REITs) work

» MORE: » MORE: How real estate investment trusts (REITs) work

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

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 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 for gifts would apply.

If you receive real estate as a gift, the rules 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.

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. About the author Connor Emmert Connor Emmert Connor Emmert is a former NerdWallet writer and an authority on investing. Prior to joining NerdWallet, he spent several years as a licensed financial advisor with Bank of America/Merrill Lynch and Fisher Investments. He earned his bachelor's degree in English at Colby College. See full bio.

Helpful resources

Helpful resources Best Financial Advisors Search for a Financial Advisor Near You How to Choose a Financial Advisor in 5 Steps 3 Best Wealth Management Services More like this Investment Basics Investing How Much Does a Financial Advisor Cost? Most financial advisors charge based on how much money they manage for you. Fees are typically 1% a year but can be lower. 2 By Andrea Coombes, Taryn Phaneuf Do You Need a Financial Advisor? 7 Ways to Tell You may need a financial advisor if you're facing big life changes, don't have financial goals, have complex compensation, high tax bills or for other reasons. Taryn Phaneuf How to Find Cheap or Free Financial Advice Quality financial advice is more accessible than ever — and much of it is free or inexpensive. Here's how to get it. Anna-Louise Jackson Retirement Calculator Are you on track to save enough for retirement? Use our calculator to check your progress, see how much retirement income you'll have and estimate how much more you should save. 2 By June Sham, Alana Benson