Cost Basis Calculator

Enter your purchase price, shares, sale price, and any fees to calculate your cost basis, capital gain or loss, and break-even price.
Luis GonzalezCreated by Luis GonzalezLast updated:

How to Use This Calculator

  1. 1

    Enter Your Purchase and Sale Details

    Input the purchase price per share, total number of shares purchased, any additional acquisition costs (commissions, fees), the sale price per share, and the number of shares sold. Optionally enter adjustments for stock splits, dividend reinvestments, or return of capital.

  2. 2

    Review Your Results and Insights

    The calculator displays your Capital Gain or Loss, Total Purchase Cost, Cost Basis per Share, Total Cost Basis for shares sold, and Return on Sale percentage. The Insights panel shows your break-even price, fee impact on each share's basis, and a sale proceeds breakdown.

Example Calculation

An investor bought 100 shares at $50 each with $100 in brokerage fees, then sold 50 shares at $60 each with no adjustments.

Purchase Price ($)

$50

Number of Shares/Units

100

Additional Costs ($)

$100

Sale Price ($)

$60

Number of Shares/Units Sold

50

Adjustments ($)

$0

Results

Capital Gain

$450.00

Total Purchase Cost

$5,100.00

Cost Basis per Share

$51.00

Total Cost Basis (Sold)

$2,550.00

Return on Sale

17.65%

Insights card shows break-even price of $51.

Tips

Include All Acquisition Costs

Add brokerage commissions, transfer fees, and legal costs to your cost basis. Even small fees matter — $100 in fees on a 100-share purchase adds $1.00 per share to your basis, which can reduce your taxable gain or increase your deductible loss.

Choose the Right Cost Basis Method

For tax purposes, you can use FIFO (First-In, First-Out), LIFO, or Specific Identification. FIFO sells your oldest shares first, while Specific ID lets you choose which lot to sell. Use the Adjustments field to account for the method you select. Consult IRS Publication 550 for details.

Track Corporate Actions Carefully

Stock splits, mergers, and dividend reinvestments change your cost basis per share. A 2-for-1 split halves your basis per share while doubling share count. Enter these changes in the Adjustments field to keep your basis accurate.

Use Break-Even Price for Selling Decisions

The Insights panel shows your break-even price — the minimum sale price needed to avoid a loss. Compare this to the current market price before deciding to sell. If the market price is below your break-even, selling would generate a capital loss you may be able to use for tax-loss harvesting.

Mastering Investment Tax Planning with Cost Basis Calculations

The Cost Basis Calculator is an essential tool for investors to accurately determine the original value of an asset for tax purposes, revealing capital gains or losses upon sale.

Proper cost basis tracking is critical for minimizing tax liabilities and making informed investment decisions.

In 2026, with evolving tax regulations and market volatility, understanding how transaction costs and adjustments like stock splits affect your basis can mean the difference between significant tax savings and overpayment.

Understanding Why Cost Basis is a Core Investment Metric

Cost basis is more than just the purchase price; it's the foundation for calculating an investor's profit or loss, which directly impacts tax obligations.

Without an accurate cost basis, it's impossible to correctly determine capital gains or losses, leading to potential IRS scrutiny or missed opportunities for tax optimization.

This metric influences decisions on when to sell, which shares to sell (e.g., high-basis vs. low-basis lots), and how to manage portfolio rebalancing.

For instance, incorrectly calculating the cost basis on a $10,000 investment could result in hundreds or even thousands of dollars in unnecessary taxes.

Calculating Investment Costs and Gains: The Logic Explained

The Cost Basis Calculator streamlines the process of determining your investment's financial standing.

It first calculates the total cost to acquire all shares, then derives a cost basis per share, and finally computes the total cost basis for the specific shares sold.

The formulas are as follows:

Total Purchase Cost = Purchase Price × Number of Shares + Additional Costs

Cost Basis per Share = Total Purchase Cost / Number of Shares

Total Cost Basis (Sold) = Cost Basis per Share × Number of Shares Sold + Adjustments

Gain/Loss = Sale Price × Number of Shares Sold - Total Cost Basis (Sold)

Return on Sale (%) = (Gain/Loss / Total Cost Basis) × 100

Break-Even Price = Cost Basis per Share
💡 Understanding your cost basis is crucial for evaluating overall portfolio health. For a broader view of your business's financial standing, explore our Business Equity Calculator.

Determining Capital Gains for a Partial Stock Sale

Imagine an individual who purchased 100 shares of a company's stock at $50 per share, incurring $100 in brokerage commissions.

Later, they decide to sell 50 of those shares at $60 per share, with no further adjustments.

  1. Calculate the Total Purchase Cost: $50 × 100 + $100 = $5,100.
  2. Determine the Cost Basis per Share: $5,100 / 100 = $51.00 per share.
  3. Calculate the Total Cost Basis for the Sold Shares: $51.00 × 50 + $0 = $2,550.00.
  4. Compute the Capital Gain: $60 × 50 - $2,550.00 = $3,000.00 - $2,550.00 = $450.00.
  5. Calculate the Return on Sale: ($450.00 / $2,550.00) × 100 = 17.65%.

The investor realized a capital gain of $450.00 on the sale of 50 shares, a 17.65% return.

The break-even sale price was $51.00 per share — the $100 in fees added $1.00 per share to the basis compared to the raw $50 purchase price.

💡 To see how effectively your business generates revenue from its investments after accounting for costs, our Business Profitability Calculator can provide a comprehensive overview.

Understanding Investment Benchmarks and Cost Basis Strategies

In investment management, professionals consider various benchmarks when assessing cost basis and its impact.

For actively traded stocks, a common strategy is to monitor the average cost basis over time, especially when making multiple purchases at different prices.

For long-term investors, the goal is often to hold assets with a low cost basis for extended periods to benefit from lower long-term capital gains tax rates, which range from 0% to 20% depending on income in 2026.

Conversely, investors might strategically sell high-basis shares to minimize taxable gains or generate tax losses for harvesting.

For mutual funds, the average cost method is often the default, where the cost basis is averaged across all shares purchased, simplifying calculations compared to tracking individual lots.

Frequently Asked Questions

What is cost basis in investments?

Cost basis is the original value of an asset for tax purposes, adjusted for factors like commissions, stock splits, or dividend reinvestments. It includes the purchase price plus all acquisition costs. For example, buying 100 shares at $50 with $100 in commissions gives a cost basis of $5,100 total, or $51 per share.

How does cost basis affect capital gains tax?

Your capital gain or loss equals the sale proceeds minus your cost basis. A higher cost basis reduces your taxable gain. For example, selling 50 shares at $60 produces $3,000 in proceeds. With a $51 per share basis ($2,550 total), the taxable gain is $450 — not $500 — because the $100 in fees increased your basis.

What is the break-even price?

The break-even price is the minimum sale price per share needed to avoid a loss, which equals your cost basis per share. If you paid $50 per share with $100 in fees on 100 shares, your break-even price is $51 per share. Any sale above $51 generates a gain; below $51 produces a loss.

What are common adjustments to cost basis?

Common adjustments include stock splits (a 2-for-1 split halves your per-share basis), dividend reinvestments (added to your basis), return of capital distributions (reduce your basis), and wash sale adjustments (disallowed losses added back to the replacement shares' basis).

What is the difference between FIFO and Specific Identification?

FIFO (First-In, First-Out) assumes you sell the oldest shares first, which may result in larger gains if prices have risen. Specific Identification lets you choose which lot to sell, allowing you to sell higher-basis shares first to minimize taxable gains, or lower-basis shares to realize losses for tax-loss harvesting.

How do I calculate cost basis for multiple purchases at different prices?

Run the calculator separately for each purchase lot, entering that lot's purchase price, share count, and fees. Each lot has its own cost basis per share. When you sell, use your chosen method (FIFO or Specific ID) to determine which lot's basis applies. The Adjustments field can account for any basis modifications across lots.