Stock Cost Basis Calculator
Average share price and total cost across multiple buys.
Input sheet
DIY at your own risk. Calcora's calculators and guides are general estimates and information only — not professional, engineering, legal, or safety advice. Always verify local building codes and permit requirements, and hire a licensed pro for electrical, gas, plumbing, structural, or any work you're not fully comfortable doing yourself.
When you buy the same stock at different prices over time, your cost basis is the blended average you actually paid per share — not the price of any single purchase. This calculator combines multiple buys and trading fees into one accurate per-share cost, the number that determines your taxable gain or loss when you eventually sell.
How it works
Average cost basis = (Σ shares × price + fees) ÷ total shares.
Cost basis is the total amount invested to acquire a position, including commissions and fees. To find the average cost per share, the calculator adds the dollars spent on each lot (shares times price), adds total fees, then divides by the combined share count. The result is the figure brokers report and the IRS expects you to use under the average-cost method.
Folding fees into the basis matters because it raises your recorded cost. A higher cost basis means a smaller capital gain when you sell, which lowers the tax you owe. This calculator supports two buy lots plus a single fees field; for positions built from more than two purchases, total each additional lot's shares and dollars into the existing fields to keep the blended average correct.
Average cost basis per share = (Buy 1 shares × Buy 1 price + Buy 2 shares × Buy 2 price + total fees) ÷ total shares, where total shares = Buy 1 shares + Buy 2 shares.
Worked examples
You buy 100 shares at $20, then 50 more shares at $26, with no fees. → Average cost basis = $22.00 per share across 150 shares ($3,300 total).
Total cost = 100 × $20 + 50 × $26 = $2,000 + $1,300 = $3,300. Total shares = 100 + 50 = 150. $3,300 ÷ 150 = $22.00 per share.
Same two buys, but you paid $15 in total commissions across both trades. → Average cost basis = $22.10 per share ($3,315 total cost).
Total cost = $2,000 + $1,300 + $15 in fees = $3,315. $3,315 ÷ 150 shares = $22.10 per share. The fee adds $0.10 to each share's basis.
Tips & gotchas
- Use this average-cost figure when you sell only part of a position; it spreads the basis evenly across every share rather than tying it to one specific lot.
- If your broker lets you choose a lot-identification method (FIFO, LIFO, or specific-ID), average cost may differ from what you can elect — confirm which method your account uses before relying on this number for taxes.
- Reinvested dividends count as additional purchases. Add those shares and the dollars reinvested into a buy lot so your basis isn't understated.
- Keep your trade confirmations. The blended average is only as accurate as the share counts, prices, and fees you feed in, and brokers occasionally report adjusted basis for corporate actions like splits or mergers.
FAQ
Why include fees?
Commissions raise your true cost basis, which lowers the taxable gain when you sell.
What is cost basis and why does it matter?
Cost basis is the total you paid to acquire a stock position, including fees. It is subtracted from your sale proceeds to determine your capital gain or loss, so an accurate basis directly controls how much tax you owe.
How do stock splits affect my cost basis?
A split changes your share count but not your total invested dollars, so your per-share basis drops proportionally. After a 2-for-1 split, a $22.00 basis on 150 shares becomes $11.00 on 300 shares — same $3,300 total.
Can I use this for more than two purchases?
Yes. Combine the extra lots into the two available buy fields by entering aggregate share counts and a weighted price, or add the additional cost into the fees field. As long as total dollars and total shares are correct, the blended average is accurate.
Does the average cost basis change when I sell shares?
Selling shares does not change your per-share average under the average-cost method — only buying more at a different price does. Your remaining shares keep the same basis you calculated here until your next purchase.
Related calculators
Margin vs Markup Calculator · Profit Margin Calculator · Stacked Discount Calculator · VAT Calculator · Freelance Hourly Rate Calculator