Skip to content
Finance

Stock Average Calculator - Cost Basis

Enter up to five stock purchases - each with a share count and a price per share - and this calculator works out your weighted-average cost basis instantly. Add an optional commission per lot to fold trading fees into the cost, and enter the current market price to see your unrealized profit or loss and the percentage return on your position. The break-even price tells you exactly what the stock needs to reach for you to recover your full investment including fees.

Your details

The current share price. Leave at zero if you only want the cost basis without a profit/loss calculation.
per share
Number of shares bought in the first purchase.
Brokerage fee or commission paid for this lot (optional).
Currency
Average cost per shareUnrealized gain
$111.0000

Weighted-average cost basis per share across all lots, including commissions.

Total shares held25
Total invested$2,775.00
Current position value$3,875.00
Unrealized profit / loss$1,100.00
Return on investment39.64%
Total invested$2,775.00
Current value$3,875.00
Unrealized P/L$1,100.00
-$1k$1k$4k56111167
Market price per share ($)
  • Unrealized P/L
  • Position value

Average cost basis: $111.00 per share

  • Your weighted-average cost basis is $111.00 per share across 25 total shares, for a total investment of $2775.00.
  • At the current price of $155.00, your position shows an unrealized gain of $1100.00 (39.64%).
  • You are $44.00 per share above your break-even of $111.00.
  • Cost basis does not include dividends received or potential tax obligations; consult a tax adviser for capital-gains treatment of your specific lots.

Next stepIf you are averaging down, check whether the position still fits your risk budget at the larger share count before adding.

Purchase lot breakdown

LotSharesPrice/shareCommissionLot cost
Lot 110$120.00-$1200.00
Lot 215$105.00-$1575.00

Lot cost = shares x price per share + commission.

Formula

Average cost=i=1n(sharesi×pricei+commissioni)i=1nsharesi\text{Average cost} = \frac{\sum_{i=1}^{n} (\text{shares}_i \times \text{price}_i + \text{commission}_i)}{\sum_{i=1}^{n} \text{shares}_i}

Worked example

Investor buys 10 shares at $120 and then 15 shares at $105, both with no commission. Total cost = 10x120 + 15x105 = 1200 + 1575 = $2775. Total shares = 25. Average cost = 2775/25 = $111.00 per share. At a current price of $130, position value = 25x130 = $3250. Unrealized gain = 3250 - 2775 = $475 (17.12%).

What is cost basis and why does it matter?

Cost basis is the total amount you paid for a group of shares, including any brokerage commissions, divided by the number of shares you own. It is the starting line for calculating your profit or loss when you eventually sell. If you bought a stock once at a single price, the math is trivial. But most long-term investors buy the same stock multiple times at different prices, and the weighted-average approach this calculator uses blends all those purchases into a single per-share figure. That figure matters in two ways: it tells you whether you are currently sitting on a gain or a loss, and it is the number the IRS (or your country equivalent) uses to calculate your taxable gain when you sell.

How the weighted-average cost basis is calculated

The formula is straightforward: multiply the number of shares in each lot by its price per share, add any commission paid on that lot, sum all those amounts, then divide by the total number of shares across every lot. For example, buying 10 shares at $120 and then 15 more at $105 gives a total cost of $2,775 across 25 shares, an average of $111.00 per share. A simple arithmetic average of the two prices (($120 + $105) / 2 = $112.50) would be wrong because the second purchase was larger; the weighted average correctly weights each price by how many shares it represents. Commissions raise your cost basis, which reduces your taxable gain on a future sale, so it is worth recording them even when they are small.

Averaging down vs. averaging up

Averaging down means buying more shares after the price has fallen, which lowers your cost basis and reduces the price the stock needs to reach for you to break even. It is a common strategy, but it has risks: it increases your position size and therefore your total exposure to a stock that is already declining. Averaging up means adding shares after the price has risen, which raises your cost basis. This is often done by momentum investors who believe the trend will continue; the trade-off is that the stock now has to rise even further to be profitable on the newer shares. Neither strategy is inherently better - the right choice depends on your conviction in the investment and your overall risk budget.

Break-even price and unrealized profit or loss

Your break-even price is the average cost per share when commissions are included. The stock must trade at or above that level for your position to be profitable overall. Unrealized profit or loss is the difference between your current position value (current price x total shares) and your total cost. It is called unrealized because you have not yet sold; the gain or loss only becomes taxable when you close the position. Percentage return is the unrealized profit or loss divided by total cost, expressed as a percentage - the same figure you would see on a brokerage statement under "total return."

Cost basis methods - which one to use

MethodHow it worksBest when
Weighted averageTotal cost of all shares divided by total shares held. Used by this calculator.Mutual funds (required by IRS) or when you treat a position as a single block
FIFO (First In, First Out)Oldest shares are considered sold first.Share price is falling - selling older, higher-cost shares reduces taxable gain
LIFO (Last In, First Out)Newest shares are considered sold first.Share price is rising - selling newer, higher-cost shares reduces taxable gain
Specific identificationYou choose exactly which lot to sell.Maximum tax flexibility - requires good records; most brokers now support this
Highest costHighest-cost lot is sold first regardless of purchase date.Minimizing current-year gain when prices have risen significantly

The IRS recognizes several cost basis methods for stocks. Each can produce a different taxable gain on the same sale.

Frequently asked questions

What is the weighted-average cost basis?

It is the total amount you paid for all your shares - including commissions - divided by the total number of shares you hold. Because you may have bought shares at different prices over time, a simple average of the prices would ignore the fact that you bought different quantities at each price. The weighted average accounts for that by giving larger lots more influence on the final figure.

Does this calculator support fractional shares?

Yes. Enter any decimal number in the shares field, for example 2.5 shares. Many brokers now allow fractional share purchases, particularly for high-priced stocks, and the weighted-average formula handles them exactly the same way.

Should I include commissions in my cost basis?

Yes, for tax purposes. The IRS allows you to add brokerage commissions to your cost basis, which reduces your taxable gain when you sell. The commission fields in this calculator fold that cost into the per-share average. If your broker charges no commission (common with most modern retail brokers), simply leave those fields at zero.

What is the difference between averaging down and dollar-cost averaging?

Averaging down is a deliberate decision to buy more of a stock after its price has fallen, specifically to lower your cost basis. Dollar-cost averaging (DCA) is a scheduled investment strategy where you invest a fixed amount of money at regular intervals regardless of the price - sometimes buying more shares when the price is low and fewer when it is high. DCA is about discipline and removing emotion from timing decisions; averaging down is a tactical response to a price drop in a position you already hold.

Which cost basis method is best for taxes?

It depends on the situation. Specific identification gives you the most flexibility because you choose exactly which lot to sell, allowing you to minimize current-year gains or harvest losses as needed. FIFO is the IRS default for stocks if you do not specify a method. Weighted average is required for mutual funds and optional for ETFs. Talk to a tax adviser before choosing a method, as the decision can be locked in once you start selling a position.

Does cost basis reset after a stock split?

Yes. After a stock split, you divide your total cost basis by the new number of shares to get the adjusted per-share basis. For example, if you paid $2,000 for 10 shares ($200 each) and the stock does a 2-for-1 split, you now hold 20 shares with a total basis of $2,000, so $100 per share. Your brokerage should adjust this automatically, but it is worth verifying.

Can I use this calculator for ETFs, options, or crypto?

The weighted-average calculation itself works for any asset where you have a share count and a purchase price, so ETFs are a natural fit. For options, the concept of cost basis applies but the tax treatment is different. For cryptocurrency, the IRS treats crypto as property, and cost basis rules are similar to stocks, but the specific tracking requirements differ by jurisdiction. Always verify with a tax professional for non-stock assets.

Sources

Written by Sarah Klein, CFP Certified Financial Planner · Chicago, USA

Fifteen years translating mortgage tables and amortization schedules into decisions that actually help real borrowers.

How we build & check our calculators

This tool provides general information and education, not professional advice. For decisions about your health or finances, consult a qualified professional.

Search 3,500+ calculators

Loading search…