What Is Cost Basis of a Stock?
Cost basis is the original value of a stock investment for tax purposes. When you purchase shares of a company, the cost basis is typically the price you paid per share multiplied by the number of shares, plus any commissions or transaction fees. This figure is essential because it determines your capital gain or loss when you eventually sell the shares.
For purchases at different prices, the total entered acquisition cost divided by the total shares gives a weighted average. Historical closes provide a hypothetical purchase-price proxy. Use your transaction records for actual cost and tax reporting; this tool does not select sold lots or process tax adjustments.
How to Use This Cost Basis of Stock Calculator
- 1
Search for the Stock
Type the ticker symbol (e.g., AAPL, TSLA, MSFT) in the search box and select the correct company from the dropdown results.
- 2
Add Your Purchase Lots
For each purchase, enter the number of shares and the date you bought them. The calculator looks for a close on or before that date within seven days. You can also enter a manual price if you know the exact price you paid.
- 3
Add More Lots as Needed
Click "Add Lot" to include additional purchases. There is no limit to the number of lots you can add.
- 4
Review Your Results
Click "Calculate Cost Basis" to see your weighted average cost per share, total investment, current market value, and unrealized profit or loss — all based on your entered quantities and prices or available provider data.
Cost Basis Formula
The weighted average cost basis is calculated using this formula:
Total Cost = ∑ (Sharesi × Pricei)
Average Cost Basis = Total Cost / Total Shares
Unrealized P&L = (Current Price − Average Cost) × Total Shares
For a hypothetical example, assume you bought 50 shares at $150 and later bought 30 more shares at $170, your total cost is (50 × $150) + (30 × $170) = $12,600 for 80 shares. Your average cost basis is $12,600 / 80 = $157.50 per share.
Why Cost Basis Matters for Investors
Tax Reporting
Your cost basis determines the capital gain or loss reported on your tax return. A higher cost basis means a smaller taxable gain (or larger deductible loss) when you sell. Accurate cost basis tracking is required by the IRS.
Break-Even Analysis
The average entered cost is a price-only reference. Exit costs, income, financing and taxes can change the true break-even result; these are not modeled here.
Dollar-Cost Averaging
If you invest a fixed amount regularly, your cost basis reflects the weighted average of all purchase prices. Regular purchases change entry timing but do not guarantee a profit or protect against a sustained decline.
Portfolio Performance
Entered costs and a quote snapshot give an unrealized price-only comparison. Dividends, realized sales, cash flows and holding periods are needed for broader return analysis.
Cost Basis Accounting Methods
U.S. stock-sale basis generally follows the actual identified lot. If shares cannot be adequately identified, FIFO generally applies. Average basis has limited eligibility; it is not the default method for ordinary individual stocks.
- Position average here: a descriptive weighted average of entered purchases, not a tax election.
- Specific identification: identify the shares with the broker and retain the required confirmation and records.
- FIFO: generally uses the earliest acquired shares when adequate identification is unavailable.
- Eligible average basis: certain mutual-fund and dividend-reinvestment-plan shares can qualify under IRS rules. Check the required election and eligibility.
- LIFO/HIFO labels: lot-selection preferences do not override identification requirements or determine the best after-tax result by themselves.
See IRS Topic 703 and Publication 550. This page does not calculate a tax return.
Events That Adjust Your Cost Basis
Several corporate actions and events can change your cost basis beyond simple purchases:
- Stock Splits — A 2-for-1 split doubles your shares and halves your cost per share. The total cost basis remains the same before other adjustments. The calculator does not adjust quantities: you must match each lot to the fetched price basis.
- Reinvested Dividends — Dividends reinvested to buy additional shares increase your total shares and total cost basis. Each reinvestment is a new purchase lot.
- Return of Capital — Distributions classified as return of capital generally reduce basis; amounts beyond zero basis may be taxable. This calculator does not apply that adjustment.
- Wash Sales — If you sell at a loss and buy substantially identical securities within 30 days before or after the sale, wash-sale rules may disallow the loss. Replacement-share basis treatment has exceptions, including IRA purchases; this tool does not calculate it.
- Mergers & Acquisitions — When companies merge, your cost basis may be allocated across new shares or cash received based on the exchange ratio.