When you sell an investment in a taxable account, you do not pay tax on the whole amount you receive — only on the profit. That profit is the sale price minus your cost basis, the amount you originally paid. Cost basis sounds like dry accounting, but it is one of the most consequential numbers in your investing life: get it wrong and you can overpay your taxes by hundreds or thousands of dollars; manage it well and you can legally shrink your bill.

Stat cards explaining that cost basis is what you paid, taxable gain is sale price minus basis, and you can often choose which lot to sell
Your taxable gain is the sale price minus your cost basis. A higher basis means a lower bill.

The basic formula

Cost basis is what you paid for an investment, including any commissions. When you sell, your capital gain (or loss) is simply the sale proceeds minus the basis. Buy a share for $100 and sell it for $150, and your taxable gain is $50, not $150. The higher your basis, the smaller your gain, and the smaller your tax bill. This is why tracking basis accurately is not a nicety — it directly determines what you owe. How that gain is then taxed depends on how long you held it, which the capital gains tax guide covers.

Reinvested dividends raise your basis (don't pay tax twice)

This is the most commonly botched part of cost basis. If you have a fund set to reinvest dividends, every reinvestment is a small purchase of new shares — and you already paid tax on those dividends in the year they were paid. Those reinvested amounts are added to your cost basis. Forgetting this means you would be taxed twice: once on the dividend when it was paid, and again as a "gain" when you sell. Over years of reinvesting, the overlooked basis can be substantial. Always count reinvested dividends and distributions as part of what you paid.

FIFO vs specific-lot identification

If you bought shares of the same fund at different times and prices, each batch is a "lot" with its own basis. When you sell only some of your shares, which lot's basis applies? You have a choice, and it matters.

  • FIFO (first-in, first-out) is the default at most brokerages: it assumes you sell your oldest shares first. Because the oldest shares are often the ones with the lowest basis (bought when the price was lower), FIFO frequently produces the largest taxable gain.
  • Specific-lot identification lets you choose exactly which shares to sell. By selecting lots with a higher basis, you realize a smaller gain — or by selecting lots trading below your purchase price, you can deliberately harvest a loss.

Specific-lot identification is the more powerful method because it gives you control. To use it, you generally must identify the lots at the time of sale; you cannot reassign them afterward. This control is what makes tax-loss harvesting precise, and it is a core habit of running a taxable brokerage account well.

How basis adjusts over time

Cost basis is not always frozen at the purchase price. A few events shift it:

  • Reinvested dividends and distributions add to it, as above.
  • Stock splits change your per-share basis but not your total — a 2-for-1 split halves the per-share figure across twice as many shares.
  • Return-of-capital distributions reduce your basis rather than counting as income in the year received.

Brokerages now report basis to the IRS for most investments bought in recent years, which has made record-keeping far easier than it once was. Still, basis from older purchases, transfers between brokerages, or inherited and gifted assets can require you to supply the figure yourself, so keep your statements.

The step-up in basis at death

One of the most valuable rules in the tax code applies to assets passed on at death. Inherited investments receive a step-up in basis: the basis is reset to the asset's market value on the date of the original owner's death. If your parent bought a stock decades ago for $5,000 and it was worth $50,000 when they passed, your basis becomes $50,000 — the entire $45,000 of lifetime gain is wiped away for tax purposes. Sell it the next day for $50,000 and you owe essentially nothing. This is why holding highly appreciated assets in a taxable account to leave to heirs can be remarkably tax-efficient, and it is a key reason not to needlessly sell long-held winners late in life.

Gifts work differently

Beware the mirror image: assets gifted during the giver's lifetime generally carry over the original cost basis — there is no step-up. So gifting a highly appreciated stock passes the embedded gain (and its future tax) along to the recipient, whereas the same stock inherited would have had its gain erased. The timing and method of transfer can change the tax outcome dramatically.

The practical message: track your basis carefully, include reinvested dividends, and use specific-lot selling to control your gains. To estimate the tax on a planned sale and compare lot choices, run the figures through the capital gains calculator, and use the Tax Health assessment to find where smarter basis management could lower your bill.