Learn / Investing

Investing

How to Calculate Average Stock Cost: Weighted Average Formula & Tax Basis

6 min read · Reviewed: November 2026

When you accumulate shares of a stock or ETF across different trading days, you pay different market prices. Here is how quantity-weighted averaging works, why simple price averages fail, and how tax lots function.

Interactive Tool
Stock Average Calculator
Open calculator →

Why quantity-weighted averaging is necessary

If you buy 10 shares of a company at $50 and later buy 90 shares of the same company at $100, what is your average stock price?

A simple arithmetic average of the two price tags ($50 + $100) / 2 suggests $75. However, this is mathematically incorrect because you bought nine times as many shares at the higher price. When you buy the same stock at different average prices over time, the simple average breaks down — your true weighted average, also called the stock average price, is $95.00, significantly closer to $100.

To determine your accurate break-even point and track position performance, you must use a quantity-weighted average that weights each purchase price by the volume of shares acquired. You can calculate this instantly with our free Stock Average Calculator.

What is the average stock price?

Your average stock price is the quantity-weighted cost of a single share across every purchase you have made of that stock: add up all the cash you spent, including broker fees, and divide by the total number of shares you own. It is the same figure as the weighted average cost per share — and the price the stock must reach for you to break even.

In the worked example below, you spent $11,010.00 in total, including $10.00 of fees, for 200 shares — so the average stock price is $55.05 per share. To calculate your average stock price for your own trades, enter each lot's price and share count in the calculator and it does the weighting for you.

The weighted average cost formula

The mathematical formula sums the total capital expended across all purchases (including any transaction commissions or regulatory fees you wish to attribute) and divides that total dollar sum by the aggregate number of shares owned.

Weighted Average Cost Per Share = (Sum of [Purchase Price × Number of Shares] + Total Fees) ÷ Total Shares Owned

Hypothetical worked example

Let us walk through a practical scenario with two separate purchases and broker fees.

Illustrative 2-Lot Purchase Example

  • Lot 1: 50 shares purchased at $40.00 each = $2,000.00 (plus $5.00 transaction fee).
  • Lot 2: 150 shares purchased at $60.00 each = $9,000.00 (plus $5.00 transaction fee).
  • Total cash spent before fees = $2,000 + $9,000 = $11,000.00.
  • Total transaction fees = $10.00.
  • Total cost basis = $11,010.00 across 200 total shares.
  • Weighted Average Cost Per Share = $11,010 ÷ 200 = $55.05 per share.

How transaction fees affect your break-even

While many modern retail brokerages offer commission-free trading on major US equities, institutional investors, options traders, OTC stock buyers, and foreign market investors frequently incur per-order ticket charges, exchange fees, or currency conversions.

Incorporating these fees into your average cost per share provides an honest evaluation of your net break-even price. In the example above, without fees your average was $55.00, but fees increased your actual required exit price to $55.05. Once you establish your true cost basis, calculate your eventual return on capital using our ROI Calculator.

Average cost vs. IRS tax cost basis rules

It is crucial to recognize that an internal weighted average cost calculation may not match your official tax reporting basis when you sell a portion of your position.

In the United States, under IRS Publication 550 (Investment Income and Expenses) and Treasury Regulation § 1.1012-1(c), the default accounting method for individual equities is First-In, First-Out (FIFO). Under FIFO, when you sell 50 shares from the example above, the IRS treats the earliest lot purchased at $40.00 as sold first, resulting in a different realized capital gain than if an average basis was applied.

Average cost accounting is generally permitted by the IRS under Treas. Reg. § 1.1012-1(e) for mutual funds and dividend reinvestment plans (DRIPs), while individual equities require specific share identification (SpecID) or default to FIFO. Outside the US, statutory rules differ substantially: the UK HMRC mandates Section 104 holding pools (HMRC HS284), and the Canada Revenue Agency (CRA) mandates Adjusted Cost Base (ACB) pooling. Always verify tax lots with your brokerage tax statements (such as Form 1099-B in the US) and consult a qualified tax advisor.

Frequently Asked Questions

Does buying additional shares always lower my average cost?

No. Buying additional shares lowers your weighted average cost only if the execution price is lower than your current average cost (averaging down). If you purchase new shares at a price higher than your existing average, your average cost per share will rise.

Why does a simple arithmetic average fail for stock purchases?

A simple average adds the prices and divides by the number of orders, ignoring share count. If you buy 10 shares at $50 and 90 shares at $100, a simple average says $75, but your actual cost is $95 because 90% of your shares (90 of 100) were bought at $100 — that is $9,000 of your $9,500 total capital, or 94.7%.

How do broker commissions and exchange fees affect my true break-even price?

Broker fees, ticket charges, and foreign exchange fees increase your total cash outlay. Including fees raises your net cost basis, showing you the exact gross selling price required to break even without losing money on trade execution.

Is average purchase price accepted by the IRS for individual stock tax reporting?

Under US federal tax law (IRS Publication 550 and Treasury Reg. § 1.1012-1(c)), average cost is generally not permitted for individual corporate stocks. The IRS mandates First-In, First-Out (FIFO) unless you explicitly designate specific lots (Specific Identification) at the time of sale.

How does the IRS Wash Sale Rule (IRC § 1091) alter average cost basis?

If you sell shares at a loss and repurchase substantially identical stock within 30 days before or after the sale, the loss is disallowed for tax deduction. Instead, the disallowed loss is added to the cost basis of the newly acquired shares, raising your average cost.

Can I use the weighted average cost formula for cryptocurrency or commodities?

Yes. The mathematical principle of quantity-weighted average cost applies universally to any asset acquired in multiple tranches, including index ETFs, physical precious metals, and cryptocurrencies.