What Is Cost Basis and How Does It Work?

Quick Answer

Your cost basis on an investment is the original price you paid for the shares of stock or other security you purchased. Cost basis is used to determine your tax liability when you sell an investment or a home.

Shot of a young businesswoman using a laptop at her desk in a modern office

When you sell an investment or a home, you may be subject to capital gains taxes on the transaction. Cost basis is the original price you paid for the asset, and it's a key factor in determining your tax liabilities.

Understanding how cost basis works for an investment or a home can help you get a better idea of what your tax liability might be when you're ready to sell.

What Is Cost Basis?

The cost basis on an asset is the amount you paid for your investment. With a stock, for instance, that would include the price per share at the time of purchase, plus brokerage fees and other costs. With mutual funds, it also includes any upfront load fees.

With a home, your cost basis also includes some ongoing expenses you've incurred, such as major home improvements and casualty and theft losses.

When you sell an investment or a home, you may be subject to capital gains tax on the transaction. When filing your tax return, you'll use the sale proceeds and cost basis to determine your gain or loss, which, in turn, can be used to calculate your capital gains tax bill.

Invest Your Money Smarter

Browse Top Brokerages

Cost Basis vs. Market Value

While cost basis is the original price you paid for an investment, market value is the current price at which you could sell it.

When considering a trade or a home sale, looking at your asset's current market value can help you estimate what your potential tax consequences might be if you decide to go through with the transaction.

How to Calculate Cost Basis

The process for calculating cost basis is different for investment securities and real estate. Here's a quick summary of how to get started.

Cost Basis for Investments

With your investment portfolio, there are a few different ways you can calculate the cost basis of your assets:

  • First-in, first-out (FIFO): The default with most brokerage firms—unless you're selling your stake in a mutual fund—the FIFO method assumes that if you sell a portion of your position in a stock or other security, it's the oldest shares that go first. That said, if your first shares had a lower price than subsequent trades, that'll result in a higher gain and, therefore, a bigger tax bill.
  • Specific identification: With this option, you can choose which shares you want to sell based on their cost basis. By picking shares with a higher purchase price, you can minimize your realized gain on the sale and reduce your tax liability. While FIFO is the default in many cases, you can specify with your broker that you want to use the specific identification method instead.
  • Average cost, single category: If you own shares in a mutual fund, this method is the default. You'll calculate your cost basis by averaging the cost of all the shares you have and then multiplying it 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).

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

If the price has jumped to $20 and you want to sell five shares, you'd get $100 from the trade. Your cost basis for each share using the FIFO method would be $50—five shares multiplied by $10—resulting in a gain of $50.

With the specific identification method, you could instruct your brokerage firm to sell the five shares you bought at $14 per share, giving you a cost basis of $70 on the sale and a taxable gain of $30.

Average Cost, Single Category Method

Let's say you've purchased 100 shares of a mutual fund over the course of several months of investments, with an average cost per share of $65.

If you were to sell 20 shares at $75 per share for $1,500, your cost basis would be $1,300—the average cost of $65 multiplied by 20 shares—giving you a taxable gain of $200.

Real Estate Method

Let's say you bought a home for $200,000, and several years later, sold it for $300,000. Over the years, you put roughly $20,000 into the home for improvements and repairs. But you also received $5,000 in insurance payouts for losses.

To calculate your cost basis, you'd add the $200,000 purchase price and $20,000 in additional eligible costs, then subtract $5,000, for a total of $215,000. Your resulting gain would be $85,000, well below the exclusion amount if you lived in the home for at least two out of the past five years.

Frequently Asked Questions

  • When selling an investment or a home for a profit, your cost basis is one of the components used to determine your taxable gain on the sale.

  • If you're thinking about selling stock that was gifted to you, your cost basis will depend on the original price the gifter paid and the current fair market value of the shares.

    If the fair market value (FMV) when you received the gift was higher than the original price the buyer paid for the shares, you'll use the original price as the cost basis.

    However, if the FMV when you received the shares was lower than the original price, here's how you'll calculate the cost basis based on the stock's value when you decide to sell:

    Calculating Cost Basis of Gifted Stocks
    Stock Price at the Time of Sale Cost Basis
    Higher than the original price The original price
    Higher than the FMV at the time of the gift but lower than the original price Your selling price
    Lower than the FMV at the time of the gift The FMV at the time of the gift
  • The full list of items you can add (before subtracting adjustments) to your property's cost basis includes:

    • The amount you paid for the home, including your down payment and mortgage amount, or the cost of the land if you built the home.
    • Settlement fees you paid when you bought the home, excluding financing-related costs.
    • Real estate taxes or other costs you paid on behalf of the seller that weren't paid back.
    • Costs related to construction and improvements that are still part of the home at the time of sale.
    • Amounts spent to repair damage to the home or land it sits on.
    • Special assessments for local improvements.

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.