Stock Average Cost Basis Calculator

Calculate the weighted average entry price of one asset across multiple purchases. Use USD prices and units still held; this is a purchase-cost estimate, not an adjusted tax-basis calculation.

Shares
Price ($)
Average Cost
—
Per Share
Total Shares
0
Units
Total Cost
$0.00
Invested

Profit & Loss Analysis (Optional)

How to Use the Stock Average Calculator

  1. Enter Transactions: Input the number of shares bought and the purchase price per share for each of your trades.
  2. Add More Rows: If you have made more than two purchases, click the "Add Purchase" button to include additional transactions.
  3. Review Results: The calculator instantly updates your Average Cost, Total Shares, and Total Cost as you type.
  4. Check Profit/Loss: Enter the current market price of the stock to see your unrealized gains or losses and ROI percentage.

What is Cost Basis?

For U.S. tax purposes, purchased stock generally starts with purchase cost plus acquisition expenses. Adjustments and the specific shares sold can change the basis used for a sale. Ordinary cash dividends do not automatically reduce basis; reinvestments and return-of-capital distributions have different treatment. This calculator applies none of those rules and estimates unrealized P/L from a manually entered price, not taxable realized gain.

Why is calculating average cost important?

Multiple purchases have a quantity-weighted average, not a simple average of their prices. For example, 10 shares at $100 and 20 at $130 cost $3,600 for 30 shares, or $120 per share. Buying more below the current average lowers that average but increases the amount exposed to the asset. It does not guarantee recovery or lower losses.

The Formula

Average Cost = Total Cost / Total Shares

Where Total Cost is the sum of (Shares × Price) for all transactions.

Keep tax records separately. See IRS Topic 703, Basis of Assets and the stock, distribution and average-basis sections of IRS Publication 550. Other jurisdictions have different rules. This page does not select a reporting method.

Frequently Asked Questions

Is weighted average purchase cost the same as tax basis?

Not necessarily. This calculator totals purchases that you enter and divides by the units. It does not apply tax-lot selection, wash sales, return-of-capital adjustments, gifts, inheritance or corporate actions. U.S. average-basis tax methods apply only in specified circumstances, such as eligible mutual-fund or dividend-reinvestment shares.

What does the average entry price tell me?

It is the weighted cost per unit of the purchases entered. Selling all those units at that price would recover the entered cost before selling expenses and taxes. It does not include dividends or prove that averaging down reduces risk.

How can I include purchase commissions?

There is no separate fee field. For a row with Q units bought at P per unit and purchase fees F, enter P + F/Q in Price. For example, 10 shares at $100 plus a $5 purchase fee means entering $100.50. Selling fees are not modeled.

Can I enter fractional units or cryptocurrency?

Yes, positive fractional units use the same weighted-average arithmetic. Enter only purchases of one asset, with every price in USD. The tool does not convert currencies, track sales, or determine cryptocurrency tax basis.

How are the results calculated?

Total Cost = sum of Units × Price; Average Cost = Total Cost / Total Units. With a manually entered current price, unrealized P/L = Total Units × Current Price − Total Cost. ROI is that P/L divided by Total Cost, and is undefined when entered cost is zero.

Draft a TradingView Strategy with AI

Pineify can draft Pine Script from your strategy description. Review the generated code and test its assumptions, commissions and execution behavior in TradingView before using it. This cost calculator does not execute trades.