Cost Basis Calculator
Enter your share count, purchase price, and fees to find your cost basis.
Result
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 + commissioncost 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.
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
- Publication 551, Basis of Assets — IRS, 2025
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.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments (1)
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?