Average Cost Basis Calculator

Find your weighted average cost per share across multiple purchases, and your unrealized gain or loss at today's price.

Average cost per share $0
Total shares 0
Total cost $0
Unrealized gain / loss $0
Unrealized gain / loss % 0%

How the average cost basis calculator works

If you've bought shares of the same stock more than once, at different prices, your average cost basis is the single weighted-average price that represents your true entry point across all those purchases combined. It's not a simple average of the prices you paid — it's weighted by how many shares you bought at each price, so a large purchase at a low price pulls the average down more than a small purchase at that same price would.

The formula is straightforward: add up the total dollars spent across every lot (shares × price for each), add up the total shares bought, and divide. Average Cost = Total Cost / Total Shares. This calculator handles up to three lots at once, so you can combine several purchase dates into one clean number without doing the weighted-average math by hand.

Once it has your average cost, the calculator can also show your unrealized gain or loss if you enter the current market price — the difference between what your entire position is worth today and what you actually paid for it, both in dollars and as a percentage. This is the number that matters for deciding whether to hold, add, or sell, since it reflects your blended position rather than any single purchase in isolation.

Worked example

Suppose you bought a stock three separate times: 100 shares at $50, then 50 shares at $60, then 25 shares at $70.

Total shares = 100 + 50 + 25 = 175 shares
Total cost = (100 × $50) + (50 × $60) + (25 × $70) = $5,000 + $3,000 + $1,750 = $9,750
Average cost = $9,750 / 175 ≈ $55.71 per share.

Now suppose the stock is trading at $65 today. Your unrealized gain is ($65 − $55.71) × 175 ≈ $1,625, or about 16.67% — even though your most recent purchase (at $70) is technically underwater, your blended position as a whole is solidly in the green, because your first two, cheaper lots outweigh it.

Averaging down vs. averaging up

"Averaging down" — buying more shares after the price has fallen — lowers your average cost basis and reduces the price the stock needs to recover to for you to break even. It's a common and reasonable strategy when you still believe in the underlying investment and are comfortable increasing your position size, but it's also easy to misuse: buying more of a stock purely because it's now cheaper, without re-examining why it fell, can turn a small loss into a much larger one. "Averaging up" (buying more as the price rises) does the opposite to your cost basis but is sometimes the more disciplined choice, since it means adding to a position that's already proving you right rather than one that's proving you wrong.

Average cost basis vs. FIFO and specific-lot identification

Average cost is only one of several cost basis methods brokers use to track cost basis, and which one applies to a given sale can change how much taxable gain you report. FIFO (first in, first out) assumes the shares you sell are the oldest ones you own, which matters if your earliest lots were bought at very different prices than your most recent ones. Specific-lot identification lets you choose exactly which lot you're selling — useful if you want to intentionally realize a gain or a loss for tax purposes. Average cost, the method this calculator uses, blends every lot into one number and is most commonly the default for mutual funds, though many brokers now let you elect it for individual stocks too.

The method you use doesn't change how many shares you own or what they're worth today — it only changes how the gain or loss on a partial sale is calculated for tax purposes. If you sell your entire position at once, all three methods produce the same total gain; the difference only shows up when you sell some shares now and hold the rest for later.

Common mistakes to avoid

1. Confusing average cost with your most recent purchase price

It's easy to mentally anchor on the last price you paid, especially if it was a large or recent purchase. Your average cost basis reflects your entire position, which can be meaningfully higher or lower than any single lot — always check the blended number before deciding whether you're "up" or "down" overall.

2. Forgetting that average cost basis affects your tax bill

When you sell shares, your capital gain or loss is calculated against your cost basis — which method your broker uses (average cost, FIFO, or specific-lot identification) can change your taxable gain for the exact same sale. Check which method applies to your account before assuming this calculator's average-cost figure is what your broker will use for tax reporting.

3. Averaging down without a plan

Continuing to buy a falling stock simply because your average cost keeps dropping can turn a modest position into an oversized one without a deliberate decision to do so. Set a maximum position size or a maximum number of times you'll average down before you start, rather than deciding in the moment each time the price falls further.

Frequently asked questions

What is average cost basis?

Average cost basis is the weighted average price you paid per share across all your purchases of a given stock, calculated as total dollars spent divided by total shares bought. It's the standard reference price used to calculate your capital gain or loss when you sell.

Is average cost basis the same as FIFO or LIFO cost basis?

No. Average cost basis blends all your purchases into one weighted-average price. FIFO (first-in-first-out) and LIFO (last-in-first-out) instead track individual lots separately and assume you sell specific lots first. Brokers may let you choose a cost-basis method for tax purposes — check which method applies to your account.

Does buying more shares at a lower price always lower my average cost?

Yes, as long as the new purchase price is below your current average, adding those shares pulls the weighted average down — this is the mechanic behind dollar-cost averaging and "averaging down." The more shares you buy at the lower price relative to your existing holding, the bigger the effect.

Does this calculator account for dividends or fees?

No — it computes a simple share-weighted average of the purchase prices you enter. If you paid a commission on each purchase, add it into that lot's effective price per share for a more precise cost basis.

What if I have more than three purchase lots?

Combine lots at very similar prices into a single entry (using their own combined average), or run the calculator in two passes: compute the average for your first several lots, then treat that result as a single "lot" alongside your remaining purchases.