Investment Planning · Guide

How to Calculate Average Stock Cost With Fees

Learn how to calculate weighted average stock cost with commissions, additional purchases, target average price, break-even gain and stock splits.

Open the related calculator →

To calculate average stock cost, add the full acquisition cost of every purchase—including eligible purchase commissions or transaction fees—and divide by the total number of shares acquired.

Average stock cost per share
=
Total acquisition cost
÷
Total shares

Assume two purchases:

10 shares at $100 with a $5 fee
5 shares at $80 with a $5 fee

The total acquisition cost is:

(10 × $100 + $5)
+
(5 × $80 + $5)
=
$1,410

The total number of shares is:

10 + 5
= 15 shares

The weighted average stock cost is:

$1,410 ÷ 15
= $94.00 per share

At a current price of $90, the position is $60 below its tracked acquisition cost and requires approximately a 4.44% price increase to return to $94 before any selling costs or taxes.

Calculate weighted average stock cost with the BasisPilot Average Cost Calculator →

Average stock cost formula

For multiple purchases:

Total acquisition cost
=
Σ (Shares purchased × Purchase price + Purchase fees)
Total shares
=
Σ Shares purchased
Weighted average cost per share
=
Total acquisition cost ÷ Total shares

For n purchases:

Average cost
=
[(q₁ × p₁ + f₁)
+ (q₂ × p₂ + f₂)
+ ...
+ (qₙ × pₙ + fₙ)]
÷
(q₁ + q₂ + ... + qₙ)

Where:

q = quantity purchased
p = purchase price per share
f = fees assigned to the purchase

The calculation is weighted by share quantity. A purchase of 100 shares affects the average more than a purchase of 5 shares.

Why a simple price average is often wrong

A common mistake is to add the purchase prices and divide by the number of purchases.

Assume:

100 shares at $20
10 shares at $40

The simple average of the two prices is:

($20 + $40) ÷ 2
= $30

But the investor bought ten times as many shares at $20.

The correct weighted average is:

Total cost
= 100 × $20 + 10 × $40
= $2,400
Total shares
= 110
Weighted average cost
= $2,400 ÷ 110
= $21.82

Comparison:

MethodResult
Simple average of prices$30.00
Weighted average by shares$21.82

The simple average ignores position size and materially overstates the tracked average cost.

When a simple average happens to work

A simple average of purchase prices is correct only when the same number of shares is purchased at every price and fees do not differ.

Example:

10 shares at $20
10 shares at $40
Weighted average
= $600 ÷ 20
= $30

Even then, unequal transaction fees can make the all-in average slightly different.

Average stock cost example with fees

Assume:

PurchaseSharesPriceFeeAcquisition cost
110$100$5$1,005
25$80$5$405
Total15$10$1,410

Step 1: Calculate each purchase cost

First purchase:

10 × $100 + $5
= $1,005

Second purchase:

5 × $80 + $5
= $405

Step 2: Add total acquisition cost

$1,005 + $405
= $1,410

Step 3: Add total shares

10 + 5
= 15 shares

Step 4: Divide cost by shares

$1,410 ÷ 15
= $94.00

Fee impact

Without the two $5 fees:

Gross purchase cost
= $1,400
Average purchase price before fees
= $1,400 ÷ 15
= $93.33

Including the fees:

Tracked all-in average cost
= $94.00

Fee impact per share:

$94.00 − $93.33
= approximately $0.67

The IRS states that the basis of stocks or bonds is generally the purchase price plus acquisition costs such as commissions and transfer fees. FINRA similarly explains that cost basis generally includes purchase price, reinvested distributions and transaction costs used to complete the purchase.

The BasisPilot calculator uses fees as user-supplied acquisition costs for investment tracking. It is not a substitute for broker tax-lot records or jurisdiction-specific tax calculations.

How to calculate profit, loss and break-even

Once average cost is known, the current unrealized result can be estimated.

Current market value

Current value
=
Current shares × Current price

Using:

15 shares
Current price: $90
Current value
= 15 × $90
= $1,350

Unrealized profit or loss

Unrealized profit or loss
=
Current value − Tracked acquisition cost
$1,350 − $1,410
= -$60

Percentage return on tracked cost

Return
=
Unrealized profit or loss
÷
Tracked acquisition cost
-$60 ÷ $1,410
= -4.26%

Break-even price

Before selling costs and taxes:

Break-even price per share
=
Tracked total cost ÷ Current shares

In this example:

$1,410 ÷ 15
= $94.00

Gain required to return to break-even

The percentage loss from cost and the percentage gain required to recover are not identical because they use different starting values.

Gain required
=
Break-even price ÷ Current price − 1
$94 ÷ $90 − 1
= 4.44%

Comparison:

Current return from cost: -4.26%
Gain required from current price: +4.44%

Selling fees raise the true cash break-even price

Assume selling the 15 shares would cost $6.

The gross proceeds required are:

Purchase acquisition cost + Selling cost
= $1,410 + $6
= $1,416

Cash break-even sale price:

$1,416 ÷ 15
= $94.40

Taxes are not included. A tax-adjusted break-even price depends on jurisdiction, account type, tax rate and the treatment of gains and losses.

How averaging down changes average stock cost

Averaging down means purchasing additional shares below the current average cost.

Starting position:

15 shares
Total tracked cost: $1,410
Average cost: $94

New purchase:

10 shares at $70
Purchase fee: $5

New acquisition cost:

10 × $70 + $5
= $705

Combined tracked cost:

$1,410 + $705
= $2,115

Combined shares:

15 + 10
= 25 shares

New average cost:

$2,115 ÷ 25
= $84.60

Average-cost reduction:

$94.00 − $84.60
= $9.40 per share

Percentage reduction:

$9.40 ÷ $94.00
= 10.00%

The position is larger, not automatically safer

Before the new purchase:

Capital committed: $1,410

After the new purchase:

Capital committed: $2,115

The average cost falls, but total capital exposure rises by $705.

If the stock continues to decline, the larger position can create a larger dollar loss.

A lower average cost does not establish that:

  • the original thesis remains valid;
  • the security is undervalued;
  • the price will recover;
  • the position fits the portfolio allocation;
  • additional concentration is appropriate.

The calculator should display both:

New average cost
and
Additional capital committed

Averaging up

Purchasing above the current average cost increases the weighted average.

Starting position:

15 shares
Average cost: $94
Total cost: $1,410

New purchase:

5 shares at $110
Fee: $5
New purchase cost
= 5 × $110 + $5
= $555
Combined cost
= $1,410 + $555
= $1,965
Combined shares
= 20
New average cost
= $1,965 ÷ 20
= $98.25

Averaging up raises the cost per share but does not by itself determine whether the additional purchase is appropriate.

How many shares to buy to reach a target average cost

A target-average calculation solves for the quantity of a proposed new purchase.

Let:

C = Current total tracked cost
Q = Current shares
T = Target average cost
P = New purchase price
F = Fixed purchase fee
V = Per-share purchase fee
q = Required new shares

The new average is:

T
=
[C + F + q × (P + V)]
÷
(Q + q)

Solving for q:

Required new shares
=
(C + F − T × Q)
÷
(T − P − V)

Example without fees

Current position:

15 shares
Total cost: $1,410
Average cost: $94

Proposed purchase price:

$70

Target average:

$85
Required shares
=
($1,410 − $85 × 15)
÷
($85 − $70)

=
($1,410 − $1,275)
÷
$15

=
$135 ÷ $15
= 9 shares

Check:

New total cost
= $1,410 + 9 × $70
= $2,040
New total shares
= 24
$2,040 ÷ 24
= $85

Example with a $5 fixed fee

Required shares
=
($1,410 + $5 − $85 × 15)
÷
($85 − $70)

=
$140 ÷ $15
= 9.3333 shares

If fractional shares are unavailable, rounding down would not reach the target:

9 shares
New average
=
($1,410 + $5 + 9 × $70)
÷ 24
=
$85.2083

Rounding up to 10 shares would move below the target:

10 shares
New average
=
($1,410 + $5 + 10 × $70)
÷ 25
=
$84.60

The tool should distinguish:

Minimum whole shares to reach or pass target: 10

from:

Exact fractional shares: 9.3333

When the target is impossible

A lower target average cannot be reached by buying at an all-in per-share cost equal to or above the target.

If:

Target average: $80
New effective purchase cost: $82

additional shares purchased at $82 cannot pull the combined average down to $80.

The calculator should return:

The target average must be above the all-in cost of the proposed purchase
and below the current average cost.

This assumes the purpose is averaging down and all quantities are positive.

How fixed and per-share fees change average cost

Fees can be structured in different ways.

Fixed transaction fee

Purchase cost
=
Shares × Price + Fixed fee

The fee per share becomes smaller for a larger purchase.

Example:

SharesPriceFixed feeFee per share
1$50$5$5.00
10$50$5$0.50
100$50$5$0.05

Per-share fee

Purchase cost
=
Shares × (Price + Per-share fee)

Example:

100 shares at $50
Per-share fee: $0.01
Total fee
= 100 × $0.01
= $1

Fixed plus per-share fee

Purchase cost
=
Shares × Price
+ Fixed fee
+ Shares × Per-share fee

Percentage-based fee

Purchase fee
=
Gross trade value × Fee percentage

If a platform charges 0.20%:

$1,000 × 0.20%
= $2

The average-cost tool must label whether the user enters:

  • one total fee;
  • a fixed fee;
  • a per-share fee;
  • a percentage fee.

It should not apply an unspecified fee automatically.

Investor.gov notes that securities transactions and investment services can involve commissions and other transaction fees, and that these costs reduce the amount retained in an investment portfolio.

What happens to average cost after a partial sale?

For simple weighted-average portfolio tracking, selling part of a position does not change the tracked average acquisition cost of the remaining shares.

Assume:

25 shares
Tracked total cost: $2,115
Average cost: $84.60

Sell:

5 shares

Cost assigned to the sold shares under the tracking average:

5 × $84.60
= $423

Remaining tracked cost:

$2,115 − $423
= $1,692

Remaining shares:

20

Remaining average:

$1,692 ÷ 20
= $84.60

The average remains $84.60.

Selling price affects realized profit, not remaining acquisition average

If the 5 shares sell at $90 with a $5 selling fee:

Net proceeds
= 5 × $90 − $5
= $445

Tracked realized result under the simple average method:

$445 − $423
= $22 profit

However, this tracking method may not match the tax basis of the shares actually sold.

For tax reporting, the applicable lot-selection rules can assign a different basis to the sold shares.

Average-cost tracking vs tax cost basis

This distinction is critical.

Investment-tracking average cost

The BasisPilot Average Cost Calculator answers questions such as:

  • What is my weighted average acquisition cost?
  • How does a proposed purchase change that average?
  • What price returns the combined position to tracked break-even?
  • How much additional capital is required?
  • What is the unrealized result relative to the tracked average?

This is a portfolio-planning calculation.

Tax cost basis

Tax basis determines taxable gain or loss under the rules of the relevant jurisdiction.

In the United States, the IRS states that stock or bond basis is generally the purchase price plus acquisition costs. When shares were purchased at different times and prices, investors should identify the specific shares sold when possible. If adequate identification is not made, FIFO may apply.

The IRS allows average basis for eligible mutual fund shares and certain shares acquired through dividend reinvestment plans, subject to the applicable requirements. That does not make average basis a universal tax method for every individual stock position.

The calculator must not claim

Use this average for your tax return.

It should say:

This result is for investment tracking and planning.
Tax basis may depend on tax lots, elections, broker records
and local tax rules.

Common US lot methods

Depending on the security, broker, account and applicable rules, tax reporting may involve:

  • specific share identification;
  • FIFO;
  • eligible average-basis elections;
  • broker default methods;
  • adjusted basis after corporate actions or wash sales.

BasisPilot should not select a tax-lot method or calculate jurisdiction-specific taxable gains in this general guide.

Useful official references:

How stock splits change average cost

A stock split changes the number of shares and the per-share cost, but it does not by itself change the total tracked cost.

Two-for-one stock split

Before split:

100 shares
Average cost: $50
Total tracked cost: $5,000

After a 2-for-1 split:

200 shares
Average cost: $25
Total tracked cost: $5,000

Formula:

New shares
=
Old shares × Split ratio
New average cost
=
Old total cost ÷ New shares

One-for-four reverse split

Before reverse split:

400 shares
Average cost: $5
Total cost: $2,000

After a 1-for-4 reverse split:

100 shares
Average cost: $20
Total cost: $2,000

Fractional-share cash payments

A split or corporate action may produce fractional shares that are paid in cash. The basis allocation and tax treatment can require broker or tax records.

A general average-cost calculator should not automatically infer those adjustments.

How dividend reinvestment affects average cost

A reinvested dividend purchases additional shares and generally creates a new acquisition lot.

Example:

Existing shares: 100
Existing total cost: $5,000
Reinvested dividend: $120
Share price at reinvestment: $40
Reinvestment fee: $0

New shares:

$120 ÷ $40
= 3 shares

Combined shares:

103

Combined tracked cost:

$5,000 + $120
= $5,120

New average:

$5,120 ÷ 103
= approximately $49.71

Although the dividend may have been automatically reinvested, it is still part of the acquisition history.

FINRA states that cost basis generally includes purchases made through reinvested dividends or capital-gains distributions. IRS rules may also require records of reinvested purchases when determining basis.

Wash sales and other basis adjustments

In the United States, a wash sale can occur when stock or securities are sold at a loss and substantially identical stock or securities are acquired within the applicable period around the sale.

Publication 550 explains that a disallowed wash-sale loss is generally added to the basis of the replacement stock, which postpones recognition of the loss.

A simple weighted-average calculator does not detect:

  • substantially identical securities;
  • purchases in other accounts;
  • spouse transactions;
  • options or contracts;
  • automatic dividend reinvestment;
  • broker-to-broker activity;
  • jurisdiction-specific anti-avoidance rules.

The calculator should not label its output “adjusted tax basis” when it has not applied these rules.

Other events that may change basis include:

  • return of capital;
  • spin-offs;
  • mergers;
  • reorganizations;
  • inherited or gifted shares;
  • employee stock compensation;
  • stock rights;
  • corporate distributions.

Use broker documents and current professional guidance when those events apply.

Multiple currencies and foreign securities

For a position purchased in one currency and evaluated in another, there are two separate effects:

  1. Change in the security price
  2. Change in the exchange rate

Example:

Stock purchased in EUR
Portfolio reported in USD

A USD cost basis calculation may require the exchange rate applicable to each purchase date under the relevant reporting method.

Using the current exchange rate for every historical purchase can distort the tracked cost.

A general single-currency average-cost tool should require all entered transactions to use the same currency and display:

Enter all purchases in one reporting currency.

It should not silently combine USD, EUR and JPY values.

Average cost and dollar-cost averaging are different

The terms are related but not interchangeable.

Average stock cost

A result:

Total acquisition cost ÷ Total shares

Dollar-cost averaging

A contribution strategy involving investments of fixed or roughly fixed monetary amounts at regular intervals.

FINRA explains that dollar-cost averaging may lead to purchasing more shares when prices are low and fewer when prices are high, which can lower average price over time. It also emphasizes that the strategy does not assure a profit or protect against losses.

A person can calculate average cost without following a dollar-cost-averaging schedule, and can use dollar-cost averaging while still tracking each purchase lot separately.

Average cost and portfolio allocation are different

A lower average cost does not show whether the position is too large within the portfolio.

Example:

Average cost falls from $94 to $84.60
Position value rises from $1,350 to $1,750 at a $70 market price

The purchase improves the tracked break-even price but increases concentration.

Before adding shares, consider:

Current position weight
Post-purchase position weight
Additional capital committed
Maximum allocation limit

Use the Portfolio Rebalancing Calculator to evaluate allocation changes separately.

Common average stock cost mistakes

1. Taking a simple average of purchase prices

Purchase prices must be weighted by share quantity.

2. Ignoring acquisition fees

Commissions and eligible purchase costs increase the all-in acquisition cost.

3. Subtracting selling fees from purchase cost

Selling fees affect net sale proceeds or cash break-even; they are not part of the historical purchase amount in the same way as acquisition fees.

4. Treating average cost as universal tax basis

Tax treatment can depend on lots, identification methods, broker elections and jurisdiction.

5. Ignoring reinvested dividends

Reinvestment adds shares and acquisition cost.

6. Forgetting stock splits

A split changes shares and per-share cost while preserving total cost, subject to other adjustments.

7. Entering negative fees

Fees should normally be zero or positive. Rebates require explicit handling.

8. Combining different securities

Do not average two different stocks or funds into one per-share cost.

9. Combining different currencies without conversion

All inputs must use one consistent reporting currency.

10. Assuming averaging down reduces risk

It lowers the tracked average only when the new all-in purchase cost is below the current average. It also increases capital exposure.

11. Ignoring whole-share rounding

The exact number of shares needed for a target average may be fractional.

12. Hiding unused cash

When a budget does not divide evenly by share price, the unspent amount should remain visible.

13. Entering the proposed purchase fee twice

Do not add it to the entered share price and also enter it separately.

14. Using current market value as total acquisition cost

Market value and historical acquisition cost answer different questions.

15. Calculating return from average price without total fees

The return can be overstated if acquisition or selling costs are excluded.

Practical average-cost workflow

A reliable tracking process is:

1. Record each purchase date.
2. Record the exact quantity acquired.
3. Record execution price.
4. Record acquisition fees.
5. Record reinvested distributions as new purchases.
6. Adjust shares for splits and corporate actions.
7. Keep all values in one reporting currency.
8. Sum total acquisition cost.
9. Sum current shares.
10. Calculate weighted average cost.
11. Compare with current value.
12. Review tax-lot records separately before selling.

Broker confirmations and account statements should be retained. FINRA notes that reliable investment records are important for tracking cost basis, transactions and eventual tax reporting.

Common questions

How do you calculate average stock price?

Multiply each purchase price by the number of shares purchased, add fees, add all purchase costs and divide by total shares.

Should commissions be included in average stock cost?

For an all-in acquisition-cost calculation, yes. IRS and FINRA guidance generally include purchase commissions and other acquisition costs in cost basis.

Is average stock cost the same as average purchase price?

Not always. Average purchase price may exclude fees. All-in average cost includes the acquisition costs entered.

How do I calculate average cost after buying more shares?

New average cost
=
(Current total cost + New purchase cost)
÷
(Current shares + New shares)

Does buying below my average always lower it?

Only when the all-in cost per new share is below the current average. Large fixed fees can affect small purchases.

How many shares must I buy to reach a target average?

Use:

Required shares
=
(Current total cost + Fixed fee − Target average × Current shares)
÷
(Target average − New price − Per-share fee)

The target must be mathematically reachable.

Does selling shares change average cost?

Under simple weighted-average tracking, the average of remaining shares stays the same when the proportional average cost of sold shares is removed. Tax-lot accounting may produce a different result.

What price do I need to break even?

Before selling costs and taxes, tracked break-even price is the current tracked total cost divided by current shares. Add estimated selling costs for a cash break-even estimate.

Why is the gain required to recover larger than the percentage loss?

The loss percentage uses the original cost as its denominator. The recovery percentage uses the lower current price.

How do stock splits affect average cost?

A forward split increases shares and reduces average cost per share proportionally. A reverse split reduces shares and increases per-share cost. Total tracked cost remains unchanged before other adjustments.

Do reinvested dividends affect average cost?

Yes. Reinvested distributions purchase additional shares and should be included in the acquisition history.

Can I use the calculator for tax filing?

It is designed for investment tracking and purchase planning. Tax reporting may require specific tax lots, FIFO, an eligible average-basis election or other adjustments.

Is averaging down a good strategy?

The calculation can show how a purchase changes cost and exposure, but it cannot determine whether the security or additional investment is appropriate.

Can the average cost be below every purchase price?

Not if all quantities and fees are positive. A weighted average should fall within the range of the all-in purchase costs per share.

Can I include crypto or ETF purchases?

The arithmetic can track identical units purchased at different prices, but tax, fee and corporate-action rules may differ by asset and jurisdiction.

Sources

Methodology and limitations

The formulas in this guide calculate a weighted average of user-entered acquisition costs. They do not select tax lots, determine adjusted tax basis or apply every corporate-action and jurisdiction-specific rule.

Worked examples assume that all transactions refer to the same security and use the same currency. Actual broker records may differ because of execution details, fee allocation, fractional shares, reinvested distributions, wash sales and other basis adjustments.

BasisPilot provides educational calculations and does not provide personalized investment, tax, legal or financial advice.

BasisPilot provides educational calculations and does not provide personalized investment, trading, tax or legal advice.