Glossary · tax and accounting · US rules, with other countries below

Cost Basis: What It Is and How to Calculate It

Cost basis is what you paid for an investment, fees included. When you sell, your gain or loss is what you got for the shares minus the cost basis of the shares you sold. Buy 50 shares at $200 with a $5 commission and your basis is $10,005, or $200.10 a share.

It keeps changing after you buy. Reinvested dividends add new lots, a split changes the basis per share but not the total, a wash sale moves a blocked loss onto your new shares, and inherited shares start again at their value on the day of death. Once you hold several lots, the method you use decides which of them a sale uses up: FIFO unless you pick the shares, or average cost for fund shares.

The formula
Sale proceeds−Cost basis=Gain or loss

Proceeds are after selling fees. Sell those 50 shares for $13,000 and the gain is $2,995.

Default methodFIFOthe oldest shares go first unless you name the ones you sell
Reported by brokersSince 2011for shares bought from 2011, and fund and DRIP shares from 2012
Wash sale window30 dayseither side of a loss sale; the loss moves into the new shares' basis
Cost basis calculator One sale, four methods Rules checked against the IRS on 23 October 2026

Cost basis calculator

Enter each purchase as its own lot, then the sale. You'll see the cost basis of the shares sold, the gain, and what the other methods would give. It starts with the example further down.

Your lots and your sale

Purchases

Sale

Method

Cost basis of the shares sold
$0
Gain$0
Shares you still hold0
The same sale with each method

Which lots the sale uses

Blue is sold, grey is what you keep.

US rules: a lot held more than a year when sold is long term. Buying fees are spread over the shares of that lot, and selling fees come off the proceeds. Under average cost the shares sold count as the oldest ones for the holding period. Picking LIFO or HIFO means naming those shares to your broker no later than the settlement date and getting its confirmation; average cost is only for fund shares and dividend reinvestment plans. It doesn't apply wash sales, splits or return of capital, so enter lots already adjusted for them.

One sale, four methods: 40 VTI shares out of three lots

One brokerage account, no fees, round prices. The same 40 shares sold on 12 September 2025 at $325.

Lot A10 March 2021

Bought 50 VTI at $200

$10,000
Lot B4 January 2022

Bought 30 VTI at $235

$7,050
Lot C20 January 2023

Bought 20 VTI at $195

$3,900
Sold 40 of the 100 shares12 September 2025, at $325

Proceeds of $13,000. The whole position cost $20,950, an average of $209.50 a share. Every lot is more than a year old, so any method gives a long-term gain.

FIFO

Oldest first: 40 from lot A

  • Cost basis$8,000
  • Gain$5,000

What you get if you do nothing. Brokers use it by default for shares.

LIFO

Newest first: 20 from C, 20 from B

  • Cost basis$8,600
  • Gain$4,400

A form of naming your shares, so you pick it at the broker.

HIFO

Dearest first: 30 from B, 10 from A

  • Cost basis$9,050
  • Gain$3,950

The smallest gain this year, and the cheap shares are still there for later.

Average cost

40 at $209.50 each

  • Cost basis$8,380
  • Gain$4,620

Allowed here because VTI is a fund, and only if your broker has it set for this holding.

Lot A, $200Lot B, $235Lot C, $195

Same shares, same day, same price: the gain runs from $3,950 to $5,000. At the 15% long-term rate that's $592.50 or $750 of federal tax. HIFO doesn't make the gain disappear. It leaves you holding the shares with the lowest basis, so the tax comes when you sell those.

What goes into cost basis, and what changes it later

The price you paid is only the start. These are the adjustments that most often go missing.

+Adds to your basis

Commissions and fees on the purchase$10,000 + $5

They go into the basis of the lot you bought. Fees on a sale come off the proceeds instead.

Reinvested dividendsnew lot, $60

A $60 dividend that buys 0.3 shares at $200 is taxed as a dividend that year and becomes a lot with a $60 basis. Leave it out and you pay tax on that $60 twice.

A loss blocked by the wash sale rule+ $500

Sell at a $500 loss and buy the same shares back within 30 days: the loss isn't allowed yet. It's added to the basis of the shares you bought back, and the time you held the old shares counts toward theirs. Buy them back in an IRA and the loss is gone for good.

Pay you were already taxed onRSU, ESPP

Shares from work have a basis that includes the income on your W-2. The 1099-B often shows less, sometimes zero, so you fix it on Form 8949.

±Lowers or reshapes it

Stock splits50 × $200 → 100 × $100

After a 2-for-1 split you have twice the shares at half the basis each. The total stays at $10,000 and the purchase date doesn't change.

Return of capital− box 3

A payment shown in box 3 of Form 1099-DIV isn't income. It lowers your basis, and once the basis reaches zero anything more is a capital gain.

Spin-offs and mergerssplit by value

In a tax-free spin-off the old basis is shared between your shares and the new company's in proportion to their market value, and the company publishes the split on IRS Form 8937. A tax-free share-for-share merger carries the old basis into the new shares.

Options that end in shares± premium

Exercise a call and what you paid for it goes into the basis of the shares. Get assigned on a put you sold and the premium you received comes off the basis of the shares you had to buy.

Inherited shares

The basis is the market value on the date of death (or on the later date the estate chose), not what the person paid, and the gain is always long term. Shares bought at $20 and worth $150 when inherited have a $150 basis.

Shares you were given

You take over the giver's basis and purchase date. If the shares were worth less than that when you got them, a loss is measured from that lower value and the date of the gift, and a sale between the two values gives neither a gain nor a loss.

Shares from your employer

RSUs: the amount taxed as pay when the shares were delivered. ESPP: what you paid plus any discount taxed as pay. Check the 1099-B against your W-2 before you file.

Shares bought before 2011

Brokers don't have to report the basis of these noncovered shares, and after an account transfer it's often missing. Your own records are the proof, so keep every buy confirmation.

Where cost basis shows up at tax time

Your broker's Form 1099-B, then Form 8949 and Schedule D on your return.

Each one reports only the shares it holds.
WhereWhat it says about basisWhat to check
Form 1099-B, box 1eThe cost or other basis of each sale, worked out by the brokerThat reinvested dividends, wash sales and transferred-in shares are in it
Form 1099-B, box 12Ticked when the broker reported the basis to the IRS, as it must for covered sharesNoncovered sales may show no basis at all, so you supply it
Form 8949, boxes A and DShort-term and long-term sales whose basis went to the IRSIf the basis is right and there's no adjustment, these can go straight to Schedule D
Form 8949, boxes B and ESales whose basis wasn't reportedYou enter the basis in column (e) from your own records
Form 8949, columns (f) and (g)Code W for a wash sale, code B when the reported basis is wrong, and the adjustmentRSU and ESPP sales usually need code B
Schedule DThe totals of Form 8949, short term and long termYour loss carryover from last year

Form 1099-B

Box 1e
The basis the broker worked out
Box 12
Ticked when the basis went to the IRS; noncovered shares may show none
Check
Reinvested dividends, wash sales, transferred-in shares

Form 8949

A and D
Basis reported to the IRS
B and E
Basis not reported: you enter it
Codes
W for a wash sale, B for a wrong basis, often on RSU and ESPP sales

Schedule D

What
The short and long-term totals
Check
Last year's loss carryover

The wash sale rule looks at every account you have, including an IRA and your spouse's, but each broker only sees its own. Sell at a loss at one broker and buy back at another within 30 days and your 1099-Bs usually won't show it. You make the adjustment yourself.

Cost basis in other countries

Same idea, different names and rules for which shares you sold.

CanadaAdjusted cost base (ACB)

One average cost per security across all your non-registered accounts, whichever broker sells. A superficial loss goes into the ACB of the shares that replaced them.

Adjusted cost base calculator
United KingdomSection 104 pool

Shares bought the same day go first, then shares bought in the next 30 days, and only then the pool at its average cost. That stops you selling and buying back to bank a loss.

UK share CGT calculator
SpainValor de adquisición

FIFO across every broker in your name, so the oldest shares go first even if another broker holds them. Fees count on both sides.

Investing in Spain
AustraliaCost base

You can choose which parcel you sold if you can identify it, and FIFO is the usual fallback. Residents get a 50% discount on the gain from parcels held at least 12 months.

Australian CGT calculator

Your cost basis across every broker, lot by lot

The VTI example above, entered in AllInvestView.

Tax lots

Every lot with its basis, and the four methods side by side

Each purchase stays a separate lot with its date, price and basis, from every broker you add, and a sale shows which lots it used. Under the lots, the same sales are run through FIFO, LIFO, HIFO and average cost with the gain and estimated tax for each. Pick another method at the top and the whole report is worked out under it.

See the tax report
AllInvestView AllInvestView tax report for 2025, VTI row expanded. Tax lots: 2021-03-10, 10 of 50 left at USD 200.00, cost basis USD 2,000, realized +USD 5,000; 2022-01-04, 30 at USD 235.00, basis USD 7,050; 2023-01-20, 20 at USD 195.00, basis USD 3,900; open cost basis USD 12,950, tax owed USD 750. Tax by liquidation method: FIFO USD 750 on +USD 5,000, LIFO USD 660 on +USD 4,400, HIFO USD 593 on +USD 3,950, average USD 693 on +USD 4,620 AllInvestView tax report for 2025, VTI row expanded. Tax lots: 2021-03-10, 10 of 50 left at USD 200.00, cost basis USD 2,000, realized +USD 5,000; 2022-01-04, 30 at USD 235.00, basis USD 7,050; 2023-01-20, 20 at USD 195.00, basis USD 3,900; open cost basis USD 12,950, tax owed USD 750. Tax by liquidation method: FIFO USD 750 on +USD 5,000, LIFO USD 660 on +USD 4,400, HIFO USD 593 on +USD 3,950, average USD 693 on +USD 4,620
The example's three lots and one sale in the tax report: the same four gains, from $3,950 to $5,000, and the 60 shares left with a $12,950 basis. Demo account with round prices and a 15% tax rule.View full-size View full-size
Form 8949

The US pack fills Form 8949 from the same lots

Each sale becomes Form 8949 rows in the right box, with the basis from your lots. Wash sales are caught across every account you add, and the blocked loss is added to the basis of the shares you bought back. Then each broker's total is set against its 1099-B, so you can see which one differs.

See the US tax report
AllInvestView AllInvestView US filing pack: Form 8949 box A and box D rows with columns (a) to (h), box totals, Schedule D lines 7, 15 and 16, and a 1099-B reconciliation line for each broker AllInvestView US filing pack: Form 8949 box A and box D rows with columns (a) to (h), box totals, Schedule D lines 7, 15 and 16, and a 1099-B reconciliation line for each broker
The US filing pack for 2025 on a demo account: Form 8949 rows, the Schedule D lines and the 1099-B check per broker.View full-size View full-size
Every broker in one place

Keep the cost basis of every lot, from every broker

Your accounts side by side with the basis of each lot, real returns with dividends, and a tax report that compares FIFO, LIFO, HIFO and average cost before you file. Country packs for the US, Canada, the UK, Spain, Australia and more.

Lot-level cost basis Four methods compared Free plan available

Questions about cost basis

What is cost basis in simple terms?

It's what you paid for an investment, commissions and fees included, adjusted later for things like reinvested dividends, splits and return of capital. When you sell, you take it away from what you got for the shares, and what's left is your gain or loss.

How do I calculate the cost basis of a stock?

Multiply the shares by the price you paid and add the fees. If you bought at different times, keep each purchase as its own lot. When you sell, the basis is the cost of the lots the sale uses: the oldest under FIFO, the ones you name under specific identification, or the average for fund shares.

Do reinvested dividends add to cost basis?

Yes. Each reinvested dividend is a new purchase with its own basis and date. You pay tax on the dividend in the year it's paid, so leaving it out of your basis means paying tax on the same money again when you sell.

Is cost basis the same as my average price per share?

Only under the average cost method, which the US allows for shares of mutual funds and most ETFs, and for shares bought through a dividend reinvestment plan since 2012. Your broker's app may show an average price for every holding, but for ordinary shares the basis of a sale comes from the lots it uses, FIFO unless you named them.

What if I don't know my cost basis?

Look for old trade confirmations and statements, ask the broker that held the shares, or rebuild it from the purchase date and that day's price. For inherited shares, use the value on the date of death. Without any record, the IRS can treat the basis as zero, which makes the whole sale a gain.

What is the difference between covered and noncovered shares?

Covered shares were bought after the reporting rules started: stocks from 2011, and fund and dividend reinvestment shares from 2012. Your broker reports their basis to the IRS. For noncovered shares the broker may leave the basis off, and you enter it on Form 8949 from your own records.

Does cost basis include fees?

Yes. Commissions and fees on a purchase are part of its basis, and fees on a sale come off the proceeds. Either way they make the gain smaller.

Sources

Checked on 23 October 2026.

US federal rules for individuals unless a country is named. It isn't personal tax advice.