Stock Average Calculator
Calculate your average cost per share after multiple stock purchases. See total shares, total invested, weighted average price, and unrealized P/L.
This stock average calculator computes your weighted average cost per share after multiple purchases at different prices. Enter each purchase lot - the number of shares and the price you paid - and the tool instantly shows your average cost basis, total shares held, total amount invested, and unrealized profit or loss based on the current market price. It is a practical tool for investors who build positions over time through regular buys or when averaging down after a price dip.
For informational purposes only. Not financial advice. Calculations are estimates and may not reflect your exact situation. Consult a qualified financial adviser for personalised guidance.
About Stock Average Calculator
How the Weighted Average Calculation Works
The average cost per share uses a simple weighted average formula:
Average Cost = Total Amount Invested / Total Shares
Each purchase lot contributes to both the numerator and denominator. To see how this works in practice, consider an investor building a position in a stock over four separate purchases across several months:
| Purchase | Date | Shares | Price | Cost | Running Average |
|---|---|---|---|---|---|
| Lot 1 | Jan 15 | 100 | $50.00 | $5,000 | $50.00 |
| Lot 2 | Mar 3 | 75 | $42.00 | $3,150 | $46.57 |
| Lot 3 | May 20 | 50 | $55.00 | $2,750 | $48.44 |
| Lot 4 | Aug 8 | 120 | $38.00 | $4,560 | $44.81 |
| Total | 345 | $15,460 | $44.81 |
Let's walk through each step. After Lot 1, the average is simply $50. When Lot 2 is added at $42, the total invested becomes $5,000 + $3,150 = $8,150 across 175 shares, giving an average of $8,150 / 175 = $46.57. Lot 3 at $55 pulls the average up slightly to $48.44 ($10,900 / 225 shares). Finally, the large Lot 4 purchase of 120 shares at $38 brings the average down to $15,460 / 345 = $44.81.
Notice how the average moves more when larger lots are added. The 120-share purchase at $38 moved the average down by $3.63, while the 50-share purchase at $55 only moved it up by $1.87. This is the key property of a weighted average - bigger purchases have more pull.
If the current market price is $52, your unrealized gain is (52 - 44.81) x 345 = $2,481. If the price is $40, your unrealized loss is (40 - 44.81) x 345 = -$1,660. You can also check your stock profit or loss once you decide to sell.
Why Does Cost Basis Matter for Taxes?
Your average cost basis directly affects two things: your break-even price and your tax liability when you sell. The IRS and HMRC both use cost basis to calculate capital gains. If you sell above your average cost, you owe tax on the gain. If you sell below it, you can claim a capital loss.
In the US, capital gains tax rates depend on how long you held the shares. Assets held for more than one year qualify for long-term capital gains rates, which are significantly lower than short-term rates (which are taxed as ordinary income). For 2025, long-term rates are 0%, 15%, or 20% depending on taxable income, according to IRS guidelines.
| Holding Period | US Tax Rate | UK Tax Rate (2026/27) |
|---|---|---|
| Under 1 year | 10% - 37% (ordinary income) | 18% basic / 24% higher |
| Over 1 year | 0%, 15%, or 20% | 18% basic / 24% higher |
| Annual exemption | None (offset losses only) | £3,000 CGT allowance |
The UK does not distinguish between short-term and long-term holdings for Capital Gains Tax purposes, but the £3,000 annual exempt amount (reduced from £6,000 in 2023/24 and £12,300 in 2022/23) means small gains may not be taxable at all. The rates shown are per HMRC guidance for the 2026/27 tax year. You can estimate your tax bill using the capital gains tax calculator.
Wash sale rules (US only). If you sell shares at a loss and repurchase the same or a substantially identical security within 30 days before or after the sale, the IRS disallows the loss under the wash sale rule (IRC Section 1091). The disallowed loss gets added to the cost basis of the replacement shares instead. For example, if you sell 100 shares at a $500 loss and buy 100 shares of the same stock 10 days later, you cannot claim that $500 loss on your taxes. Instead, your new shares have their cost basis increased by $500. This rule catches a lot of investors off guard, especially those who are actively averaging down on a losing position. The UK does not have an identical wash sale rule, but HMRC applies a "30-day bed and breakfasting" rule that works similarly - shares repurchased within 30 days are matched against the sale for CGT purposes.
Brokers report cost basis to tax authorities, but they may use different methods. The most common are:
| Method | How It Works | Best For |
|---|---|---|
| Average Cost | Total cost divided by total shares (what this calculator uses) | Mutual funds, ETFs, simple tracking |
| FIFO (First In, First Out) | Sells oldest shares first | Default for most US brokers |
| LIFO (Last In, First Out) | Sells newest shares first | Minimising gains in rising markets |
| Specific Identification | You choose which lots to sell | Tax-loss harvesting, minimising gains |
| Section 104 Pool (UK) | All shares pooled at average cost | Required method for UK investors |
The average cost method is simplest and is the standard for mutual fund investors in the US. For individual stocks, US brokers typically default to FIFO unless you specify otherwise. In the UK, HMRC requires the Section 104 pooling method for most share disposals, which is essentially the same weighted average approach this calculator uses. Knowing your average cost regardless of method gives you a quick sense of where you stand on a position. If you are building a diversified portfolio, the portfolio allocation calculator can help you balance across assets.
Averaging Down vs Dollar-Cost Averaging vs Lump Sum
These three approaches to building a position each have different risk profiles and suit different situations.
Averaging down is a deliberate decision to buy more shares after a price drop to lower your average cost. It works when the stock recovers, but amplifies losses if it keeps falling. This approach carries real risk - you are concentrating more capital in a single position that is already underwater. A good rule of thumb: only average down when your original investment thesis is still valid and the price drop is driven by broad market sentiment rather than deteriorating fundamentals.
Dollar-cost averaging (DCA) is investing a fixed amount at regular intervals regardless of price. It is a systematic strategy that naturally buys more shares when prices are low and fewer when prices are high. Over time, this tends to produce a favourable average cost without trying to time the market. You can model DCA scenarios with the DCA calculator.
Lump-sum investing means deploying all available capital at once. A well-known Vanguard research paper ("Dollar-Cost Averaging Just Means Taking Risk Later," 2012) found that lump-sum investing outperforms DCA about two-thirds of the time across US, UK, and Australian markets historically, because markets trend upward over the long run. The average outperformance was about 2.3% over a 12-month period.
So when does each strategy make sense?
| Strategy | When It Works Best | Main Risk |
|---|---|---|
| Lump sum | You have a large sum ready and a long time horizon | Buying at a market peak |
| DCA | You receive income regularly, or want to reduce timing risk | Missing gains in a rising market |
| Averaging down | High-conviction position with a temporary dip | Catching a falling knife |
In practice, most people use a combination. Monthly salary contributions to an ISA or 401(k) are DCA by default. Topping up a position after a 20% pullback when nothing has changed fundamentally is a reasonable average-down. Deploying a year-end bonus into an index fund in one go is a lump sum. The right choice depends on your risk tolerance and how the capital becomes available to you.
How to Track Cost Basis Across Multiple Brokerages
Many investors hold the same stock across different accounts - perhaps a taxable brokerage, a tax-advantaged retirement account, and a workplace share scheme. Each account tracks its own cost basis independently, which can create confusion.
A few practical tips for keeping your records straight:
Keep your own spreadsheet. Broker statements are the official record, but they can be hard to reconcile, especially after account transfers. Maintain a simple spreadsheet with columns for date, shares, price per share, total cost, and the broker or account. This calculator can verify your running totals at any point.
Watch out for account transfers. When you transfer shares from one broker to another, the receiving broker should carry over your cost basis. In practice, this does not always happen cleanly. The IRS requires brokers to transfer cost basis information for "covered securities" (stocks acquired after 2011), but older lots or certain transfers may arrive without cost basis data. If that happens, you will need to provide the correct basis yourself using your own records or statements from the original broker.
Separate taxable and tax-advantaged accounts. Cost basis in a 401(k), IRA, or UK ISA does not matter for annual tax purposes because gains inside these accounts are not taxed until withdrawal (or not at all for Roth IRAs and Stocks and Shares ISAs). Your average cost in these accounts is still useful for tracking performance, but do not mix it with your taxable account cost basis when preparing your tax return.
Corporate actions need manual adjustment. Mergers, spin-offs, and return-of-capital distributions all affect your cost basis in ways that brokers sometimes handle inconsistently. After any corporate action, check your broker's cost basis against the company's official allocation guidance (usually published on their investor relations page). Spin-offs are particularly tricky - your original cost basis gets split between the parent company and the new entity based on a fair market value ratio determined on the distribution date.
Common Mistakes When Tracking Cost Basis
A few things trip investors up when calculating their average cost:
Forgetting reinvested dividends. If you use a DRIP (dividend reinvestment plan), each reinvestment is a new purchase lot at that day's price. These small lots add up and change your average cost over time. Over a decade of quarterly dividends, you could have 40+ micro-lots that collectively shift your average cost by several percent. Include them in your calculation, and remember that reinvested dividends are still taxable income in the year they are received (in taxable accounts).
Ignoring stock splits. A 2-for-1 split doubles your shares and halves your per-share cost, but your total cost basis stays the same. Your average cost per share drops by half after the split. Reverse splits work the opposite way - a 1-for-10 reverse split reduces your shares by 90% but multiplies the per-share cost by 10. Make sure you adjust lot prices after any splits.
Mixing up realised and unrealised. Your unrealized P/L is a paper figure - it changes every day with the market price. You only lock in a gain or loss when you actually sell. Tax is only owed on realised gains. This distinction also matters for portfolio rebalancing - selling a winner to rebalance triggers a taxable event, even if you are reinvesting the proceeds immediately.
Not accounting for fees. Trading commissions, SEC fees, and other transaction costs are part of your cost basis. Add them to the cost of each lot for a more accurate average. Many brokers now charge zero commission on stocks and ETFs, but options contracts, international shares, and OTC securities often still carry fees. The SEC regulatory fee (currently $8.00 per million dollars of sales proceeds, as of February 2025) applies to all sell orders and reduces your net proceeds.
Overlooking wash sales when averaging down. As mentioned above, if you sell part of a losing position and buy more shares within 30 days, the disallowed loss adjusts your new cost basis. Investors who are actively averaging down on a volatile stock can accidentally trigger multiple wash sales in a row, making their true cost basis increasingly difficult to calculate by hand. If you are in this situation, check your broker's year-end 1099-B form carefully, as it should flag wash sale adjustments.
Using the wrong currency. If you buy shares listed on a foreign exchange, your cost basis should be calculated in your home currency using the exchange rate on the date of each purchase. The IRS and HMRC both require this. A stock that looks like it has gained 10% in its local currency might show a different result once currency movements are factored in.
Sources
- IRS Topic 409 - Capital Gains and Losses
- IRS Publication 550 - Investment Income and Expenses (Wash Sale Rules)
- GOV.UK - Capital Gains Tax Rates and Allowances
- HMRC Capital Gains Manual - Section 104 Share Pooling
- Vanguard Research - Dollar-Cost Averaging Just Means Taking Risk Later (2012)
- SEC - Fee Rate Advisory (Section 31 Transaction Fees)
Frequently Asked Questions
How is the average cost per share calculated?
The average cost per share is a weighted average. You multiply each purchase's shares by its price to get the cost of that lot, then add up all lot costs to get total invested, and divide by total shares. For example, buying 50 shares at $100 and 50 shares at $120 gives a total cost of $11,000 for 100 shares, so your average is $110 per share.
What does it mean to average down on a stock?
Averaging down means buying more shares after the price has dropped. This lowers your overall average cost per share. For instance, if you bought 100 shares at $50 and the price falls to $30, buying another 100 shares at $30 brings your average down to $40. You need a smaller price recovery to break even compared to your original entry.
Does averaging down always make sense?
Not always. Averaging down works well when you still believe in the company and the drop is temporary or driven by broad market moves. But if the fundamentals have changed or the stock keeps falling, adding more shares just increases your exposure to a losing position. Only average down when your investment thesis is still intact.
How is unrealized profit or loss calculated?
Unrealized P/L is the difference between your current portfolio value and your total cost basis. Multiply the current market price by total shares to get the current value, then subtract total invested. A positive number means you are sitting on a gain. A negative number means a paper loss. It only becomes realised once you sell.
Can I use this for ETFs and mutual funds?
Yes. The weighted average calculation works the same for any security where you make multiple purchases at different prices. This includes individual stocks, ETFs, mutual funds, and even crypto tokens. Just enter each purchase as a separate lot.
Related Tools
Link to this tool
Copy this HTML to link to this tool from your website or blog.
<a href="https://toolboxkit.io/tools/stock-average-calculator/" title="Stock Average Calculator - Free Online Tool">Try Stock Average Calculator on ToolboxKit.io</a>