Cost Basis Calculator
Cost basis is the average price you paid per share across all your purchases. It is the reference point for measuring gains, losses, and the tax owed when you sell. This calculator uses average cost across the lots you enter. It does not choose specific tax lots or apply FIFO, LIFO, wash sale, or broker reporting rules.
Estimate basis
Adjust the assumptions. Results update in your browser only.
Average cost basis
$106.67
Across 15 shares, the average cost is $106.67 per share.
Breakdown
- Total shares
- 15
- Total cost
- $1,600
How the Cost Basis calculator works
Cost basis is the reference price for measuring gain or loss. This tool estimates average cost basis from up to three purchase lots.
The calculator multiplies each lot share count by its purchase price, sums the costs, sums the shares, and divides total cost by total shares.
total_shares = sum(shares_i)
total_cost = sum(shares_i x price_i)
average_cost = total_cost / total_shares- Lots with zero shares or zero price are ignored.
- Commissions can be reflected by adding them to the relevant lot cost before entering the price.
- Average cost is not the same as selecting specific lots for tax reporting.
When to use it
Helpful for
- Estimating the blended price paid across several purchases.
- Preparing to measure unrealized gain or loss against a sale price.
- Including dividend reinvestment purchases as separate lots.
Can mislead when
- You plan to sell specific lots rather than use average cost.
- Wash sale adjustments, transfers, splits, or broker-reported basis differ from your inputs.
- Fees or reinvested dividends are missing from the lot history.
Common mistakes
- Leaving out reinvested dividends that purchased additional shares.
- Mixing average-cost estimates with a broker statement that uses specific lots.
- Forgetting commissions or corporate actions that adjusted basis.
- Using rounded share counts when fractional shares are material.
Worked example
The default inputs use 10 shares at 100 and 5 shares at 120. Total shares are 15, total cost is 1600, and average cost basis is 106.67 per share.
| Input | Value |
|---|---|
| Total shares | 15 |
| Total cost | $1,600 |
| Average cost | $106.67 |
Frequently asked questions
Cost basis is what you paid for an investment, including commissions, averaged across all your purchases. It is subtracted from your sale price to determine a gain or loss.
Average cost blends all purchases into one per-share figure. FIFO ("first in, first out") instead sells your earliest shares first. This calculator uses the average-cost method.
Yes. Shares bought through dividend reinvestment add to both your total cost and share count, so they should be included as additional lots.
It determines your taxable gain when you sell. A higher, accurately tracked basis means a smaller reported gain and potentially lower tax.
Screen before changing positions
Use the screener to compare quality and valuation before deciding which holdings to trim or add.