Foliostufffoliostuff
Investing

Cost Basis Calculator

See how buying more shares changes your average cost, or how selling shares affects your realized P&L and remaining cost basis. Supports averaging down, averaging up, and trimming.

Current Position

How many shares you currently hold

$
New Purchase
$

Result

New Avg Cost
Change from Current Avg
Total Shares After
Total Cost Basis

How the math works

Your average cost is total dollars invested divided by total shares held. When you buy more, the calculator adds the new dollars and shares to what you already own and recalculates. Buying below your average pulls it down, buying above pushes it up.

Selling works differently. Trimming shares does not move the average cost of what you keep. Instead, the shares you sell lock in a gain or loss against what you paid for them, and the calculator shows that realized P&L next to the cost basis of your remaining position. If you sold a specific lot rather than at your average, enter that lot's cost and the math adjusts.

A quick example

Say you hold 100 shares at a $50 average, so $5,000 invested. The stock drops to $35 and you buy 50 more for $1,750. You now own 150 shares with $6,750 in, which works out to a $45 average. The stock only has to climb back to $45 for you to break even, not $50.

FAQ

Does selling shares change my average cost?

No. Selling locks in a gain or loss on the shares you sell, but the average cost of the shares you keep stays the same. What shrinks is your total cost basis, since fewer shares remain.

Is this the method my broker uses for taxes?

Not necessarily. Brokers commonly default to FIFO for stocks, meaning your oldest shares sell first, and many let you pick specific lots. This tool uses the average cost method to show you the math of a position. For actual tax reporting, go by the lot accounting on your broker statement.

Should I average down?

That depends on the stock, and it is your call to make. Averaging down lowers your break even point, but it also puts more money into a position that is moving against you. The calculator shows you exactly what a buy does to your numbers before you place it, so at least the decision is an informed one.

Do reinvested dividends count?

Yes. Each reinvestment is a new purchase at that day's price, so it adds shares and nudges your average cost. Enter it like any other buy.

Stock Average Cost Basis Calculator | FolioStuff