Cost Basis Calculator

Enter your share count, purchase price, and fees to find your cost basis.

How it is calculated

For a single purchase the tool adds the fees to the amount paid for the shares and then spreads the total over the shares bought:

total cost basis = shares × price + commission
cost basis per share = total cost basis ÷ shares

shares is the number of shares (fractions are allowed), price is the price paid for one share, and commission is the total fee for the whole trade, not a fee per share. An empty commission counts as 0. Shares must be above 0, and price and commission cannot be negative. The tool covers one purchase at a time. To combine several lots, add their total cost bases together and divide by the combined share count. Splits, reinvested dividends and the cost method your tax authority requires are not handled.

Worked example

You buy 150 shares at 42.50 each and pay a 9.95 commission. Price of the shares: 150 × 42.50 = 6,375.00. Add the commission: 6,375.00 + 9.95 = $6,384.95 total cost basis. Per share: 6,384.95 ÷ 150 = 42.5663, shown as $42.57. If you later sell at $45.00 per share, your gain per share is measured against $42.57, not against the quoted $42.50 purchase price.

Try this example →

Common mistakes

  • Entering the commission per share. The field is the total fee for the trade, so a 9.95 flat fee should be typed once as 9.95, not multiplied by the share count.
  • Leaving out fees that raise the basis, such as brokerage or regulatory charges on the buy. Only what you type in the commission field is added.
  • Using the sale price or today's price in the price field. Cost basis is based on what you paid at purchase.
  • Averaging the prices of several purchases by hand. Different lots have different share counts, so add the total costs and divide by the total shares rather than averaging the per-share prices.
  • Forgetting that stock splits, reinvested dividends and tax-lot rules change the basis. This tool computes one plain purchase and gives no tax advice.

Sources

About this calculator

The cost basis of an investment is the total amount actually paid to acquire it, including the purchase price plus any commission or brokerage fees — not just the raw share price. It's the baseline figure used to calculate capital gains or losses when the investment is eventually sold: profit is the sale proceeds minus the cost basis.

This calculator computes both the total cost basis and the cost basis per share from your share count, purchase price, and fees. It's a routine calculation for investors and tax preparers, since accurately tracking cost basis — especially across multiple purchases of the same stock at different prices and dates — is required for correct capital gains tax reporting and for deciding which shares (or “tax lots”) to sell for the best tax outcome.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    This covers the buy side only. When you later sell, the selling commission is normally taken off the proceeds rather than added here. Using the example of 150 shares bought for a basis of 6,384.95, a sale at 45.00 a share brings 6,750.00, so the gain before any sale fee is 365.05. Keep the basis figure with your trade confirmation, since you will need it years later. Which gap do you find hardest to track, splits or reinvested dividends?

Popular calculators

All Calculators