Average Cost Basis Visualizer
Track your investment cost basis over time with interactive charts. Enter transactions manually or upload CSV/JSON files to visualize how your average cost changes with each trade.
Position Settings
Add Transaction
Position Summary - AAPL
Cost Basis History
Transaction History
| Date | Type | Shares | Price | Fees | Total | Avg Cost After | Action |
|---|---|---|---|---|---|---|---|
| 1/15/2024 | BUY | 100 | $150.00 | $9.99 | -$15,009.99 | $150.10 | |
| 3/20/2024 | BUY | 50 | $165.00 | $9.99 | -$8,259.99 | $155.13 | |
| 5/10/2024 | SELL | 30 | $180.00 | $9.99 | +$5,390.01 | $155.13 | |
| 7/25/2024 | BUY | 75 | $145.00 | $9.99 | -$10,884.99 | $151.29 | |
| 9/15/2024 | SELL | 45 | $190.00 | $9.99 | +$8,540.01 | $151.29 |
What is Average Cost Basis?
Average cost basis is the average price you paid per share of a stock, including any transaction fees or commissions. It is calculated by dividing your total investment cost by the total number of shares you own. This metric is essential for tracking investment performance and calculating capital gains or losses when you sell shares.
When you make multiple purchases of the same stock at different prices (a strategy known as dollar-cost averaging), your average cost basis changes with each transaction. Understanding your average cost helps you make informed decisions about when to buy more shares or when to sell for a profit.
How to Use This Average Cost Basis Visualizer
- Enter Your Stock Symbol: Input the ticker symbol of the stock you want to track (e.g., AAPL, MSFT, GOOGL).
- Set Current Market Price: Enter the current market price to calculate unrealized gains or losses.
- Add Transactions: Enter each buy or sell transaction with the date, number of shares, price per share, and any fees.
- Import Data (Optional): Upload a CSV or JSON file with your transaction history for bulk entry.
- Analyze Results: View your average cost per share, total cost basis, unrealized P&L, and realized P&L from closed trades.
- Visualize History: The interactive chart shows how your average cost changed over time with each transaction.
Understanding Cost Basis Calculations
The average cost basis is calculated using this formula:
Average Cost = Total Cost Basis ÷ Total Shares Owned
For example, if you bought 100 shares at $150 and then 50 more shares at $165 (with $10 fees each):
- First purchase: 100 × $150 + $10 = $15,010
- Second purchase: 50 × $165 + $10 = $8,260
- Total cost basis: $15,010 + $8,260 = $23,270
- Total shares: 150
- Average cost: $23,270 ÷ 150 = $155.13 per share
Why Track Your Cost Basis?
Tax Reporting
Accurate cost basis is required for calculating capital gains and losses on your tax returns.
Performance Tracking
Know your true return on investment by comparing current price to your actual cost basis.
Dollar-Cost Averaging
Visualize how regular investing at different prices affects your overall cost basis.
Sell Decisions
Make informed decisions about when to sell by knowing your break-even price.
Cost Basis Methods Explained
There are several methods for calculating cost basis when selling shares. This tool uses the average cost method, which is the most common for mutual funds and is accepted by the IRS for stocks. Other methods include:
- First In, First Out (FIFO): Assumes the first shares purchased are the first sold.
- Last In, First Out (LIFO): Assumes the most recently purchased shares are sold first.
- Specific Identification: You choose which specific shares to sell.
- Average Cost: Uses the average price of all shares owned (used by this tool).
Frequently Asked Questions
What is the difference between cost basis and book value?
Cost basis is the total amount you paid for your shares, including commissions and fees. Book value is an accounting term that refers to a company's net asset value. For individual investors, cost basis is the relevant metric for tracking investment performance and tax purposes.
How do stock splits affect my cost basis?
Stock splits do not change your total cost basis, but they do change your cost per share. For example, in a 2-for-1 split, your number of shares doubles while your cost per share is halved. Your total investment remains the same.
Should I include dividends in my cost basis?
If you reinvest dividends to purchase additional shares, those purchases should be included in your cost basis calculations. The dividend amount becomes part of your investment cost for those new shares.
How do I track cost basis for multiple accounts?
You should track cost basis separately for each account, as tax treatment may differ between taxable brokerage accounts, IRAs, and 401(k)s. This tool allows you to export your data and manage multiple positions independently.
Is this tool accurate for tax purposes?
This tool provides estimates using the average cost method. For official tax reporting, always verify your cost basis with your broker's records and consult a tax professional for complex situations involving wash sales, corporate actions, or inherited shares.
Related Tools
Stock Return Calculator
Free stock return calculator with DRIP analysis. Calculate total return, annualized return (CAGR), capital gains, and dividend income for any stock over any period.
DCA Calculator
Calculate the average cost and performance of Dollar Cost Averaging investment strategies.
Capital Gains Tax Calculator
Estimate the tax liability on your investment profits.
Portfolio Performance Calculator
Track and analyze the overall performance of your investment portfolio.
Stock Split Calculator
Look up any stock's complete split history with real data. See forward and reverse splits, split ratios, cumulative split factor, and adjusted price charts.
Track Your Investments Smarter with Automation
Now that you understand your cost basis, take your portfolio management further. Use Pineify to create custom Pine Script indicators that track your entry points and alert you when stocks hit your target prices.