Stock Average Cost Calculator

This stock average cost calculator determines your blended purchase price per share across multiple transactions.

You enter the share count, share price, and purchase commission for each buy lot. The formula sums your total cash spent and divides it by your total share count to output your true weighted-average cost basis.

At ModernWallet, we see many investors miscalculate their returns by relying on simple price averages that ignore the size of each trade. If you want to see how future sales generate taxable capital gains, pair this calculation with our stock profit calculator.

Interactive — edit any field

How it's calculated

Your average cost basis per share equals the total dollar amount spent across every purchase lot divided by the total number of shares you own. This calculation blends separate purchase orders into a single weighted-average figure regardless of when you bought each lot. The arithmetic weights each lot by the number of shares purchased rather than treating every transaction equally. For instance, buying 100 shares at $10 and 10 shares at $20 does not create an average cost of $15. You spent $1,200 across 110 shares. That division yields a weighted-average cost basis of $10.91 per share. Tracking this blended number shows you the break-even threshold for your entire position.

Every dollar you pay to acquire shares changes your tax baseline. Per general guidance from Internal Revenue Service (IRS) Publication 550, purchase commissions and transaction fees add directly to the cost basis of that lot, which raises your total cost per share. When you eventually sell shares, any commission paid on the sale is subtracted from your gross sale proceeds, reducing your capital gain or increasing your deductible capital loss. Trading fees matter. Comparing your future sale price against your accurate cost basis reveals your true gain or loss. If your records omit buy-side fees, you understate your cost basis and risk overpaying taxes on non-existent profits.

The IRS permits several distinct cost-basis accounting methods when you make a partial sale of a holding. Allowed methods include First-In-First-Out (FIFO), specific-share identification, and an average-cost method reserved specifically for mutual fund shares. A brokerage applies a default method automatically. You can change that default before a sale settles. According to Securities and Exchange Commission (SEC) Investor.gov guidance on brokerage account statements, individual stock shares are most commonly tracked by specific-lot identification or FIFO by default, though many brokerages permit account holders to choose their preferred method. Average-cost tracking is most commonly applied automatically to mutual fund holdings and certain dividend-reinvestment plans rather than individual equities.

Periodic investing strategies naturally generate multiple share lots across varying price levels. Many investors practice dollar-cost averaging, which involves investing a fixed dollar amount on a disciplined, recurring schedule. As explained in the SEC Investor.gov glossary entry on dollar-cost averaging, buying at regular intervals purchases more shares when prices dip and fewer shares when prices climb. This steady accumulation creates numerous distinct tax lots with separate transaction dates and prices. Our dollar-cost averaging calculator explores how this strategy functions over multi-year horizons, while this stock average cost calculator consolidates those scattered purchases into a single clear figure.

A worked example

Consider an investor who builds an equity position in an individual stock across three separate purchase lots. In the first lot, the investor buys 50 shares at $40 per share and pays a $5 brokerage commission, spending $2,005 in total ($2,000 in equity plus $5 in fees). Several weeks later, the stock drops, and the investor buys a second lot of 100 shares at $30 per share with an identical $5 commission, spending $3,005. Months later, the stock climbs, and the investor purchases a third lot of 25 shares at $50 per share with another $5 commission, spending $1,255.

To calculate the blended average cost basis, sum the total dollars spent across all three transactions: $2,005 + $3,005 + $1,255 = $6,265. Next, sum the total shares acquired across the lots: 50 + 100 + 25 = 175 shares. Dividing total outlays by total shares ($6,265 / 175) yields a weighted-average cost basis of $35.80 per share. Notice that simply averaging the raw purchase prices of $40, $30, and $50 produces an arithmetic average of $40.00 per share. That unweighted number overstates the investor's true cost by $4.20 per share because it ignores the heavy weighting of the 100-share purchase at $30.

Now imagine the investor sells 50 shares when the market price hits $45 per share, incurring a $5 selling commission. The gross sale proceeds equal $2,250 (50 shares multiplied by $45). Subtracting the $5 commission leaves net sale proceeds of $2,245. If the investor uses the average cost basis of $35.80 per share, the cost for those 50 shares equals $1,790. Subtracting the $1,790 basis from net proceeds of $2,245 yields a taxable capital gain of $455. If the brokerage instead applies First-In-First-Out (FIFO) accounting, those 50 shares come entirely from the first lot, which carried a cost basis of $40.10 per share ($2,005 / 50), resulting in a lower taxable gain of $240.

Common mistakes to avoid

Frequently asked questions

How do you calculate average cost per share?

Divide your total dollars spent by your total shares owned. First, calculate the total cost of each separate purchase lot by multiplying the number of shares by the purchase price and adding any commission paid. Second, add the total costs of all purchase lots together to find your cumulative cash outlay. Third, sum the total number of shares purchased across all lots. Finally, divide the cumulative cash outlay by the total number of shares. For example, spending $1,000 for 50 shares and $1,500 for 50 shares gives a total outlay of $2,500 for 100 shares, resulting in an average cost of $25 per share.

Does average cost basis include commissions?

Yes, purchase commissions are included directly in your cost basis. Under Internal Revenue Service (IRS) Publication 550 rules, fees and commissions paid to acquire an asset add to its initial cost basis, raising your per-share acquisition cost. When you sell shares, selling fees are deducted from the sale proceeds rather than added to the basis. Both adjustments work in your favor by lowering your net taxable capital gain or expanding your deductible capital loss.

What is the difference between average cost and FIFO for taxes?

Average cost blends every lot into a single price, whereas First-In-First-Out (FIFO) treats your oldest shares as sold first. Under FIFO, your taxable gain or loss is determined solely by comparing your sale price against the specific price you paid for the earliest acquired shares. If share prices rose steadily over time, FIFO results in a lower cost basis and a higher taxable capital gain on early sales. Average cost smooths out those price differences across all historical purchases. The IRS automatically allows the average-cost method for mutual funds, while individual stocks sold in partial blocks generally default to FIFO or specific-lot identification.

Can I choose which cost-basis method to use?

Yes, you can choose among the accounting methods permitted by IRS rules and supported by your brokerage. For individual stock shares, the IRS permits specific-share identification or FIFO. According to SEC Investor.gov brokerage guidance, brokerages establish a default method, typically FIFO, but permit investors to select specific lots or change their default standing instructions. You must specify which lot you are selling before the trade settles, as you cannot retroactively alter your cost-basis method after completing the sale.

Does dollar-cost averaging lower my average cost per share?

Dollar-cost averaging lowers your average cost per share compared to the simple average market price during volatile periods. Because you invest a fixed dollar amount at regular intervals, you automatically acquire more shares when prices decline and fewer shares when prices rise. As detailed in the SEC Investor.gov glossary on dollar-cost averaging, this dynamic pulls your weighted-average purchase price below the arithmetic midpoint of market fluctuations. However, in a market that rises continuously without pullbacks, dollar-cost averaging produces a higher average cost than investing a lump sum upfront.

Sources

We prioritize primary sources for rules, formulas, rates, limits, and definitions. See our calculator methodology and editorial policy.

Related investing calculators

Plan the bigger picture