Ad Space — Top Banner

Cost Basis Calculator

Calculate average cost basis across multiple purchase lots.
Enter price and shares for each lot to find your average cost per share and total investment.

Average Cost Basis

Cost basis is what you paid for an investment, including commissions. It is the number subtracted from your sale price to calculate your taxable gain or loss. Get it wrong and you either overpay taxes or underreport income — neither is a good outcome with the IRS.

The formula for a single purchase:

Cost Basis = (Price per Share x Shares) + Commissions

For multiple purchases of the same security, the average cost method totals everything:

Average Cost per Share = Total Cost of All Lots / Total Shares

This calculator uses average cost, which is the standard method for mutual funds under US tax law and one of four methods allowed for individual stocks.

The four IRS-approved methods for individual equities:

FIFO (First In, First Out) treats the shares you bought first as sold first. It is the default if you do not specify a method. In a rising market, FIFO usually produces the largest gains and the highest tax bill.

Specific Identification lets you pick exactly which lot to sell. This is the most tax-efficient approach when you have lots with different holding periods or prices, but it requires detailed record-keeping and an explicit election with your broker at the time of sale.

LIFO (Last In, First Out) treats the most recently purchased shares as sold first. US equities do not allow this, but it is common in other countries and for inventory accounting.

Average Cost works by pooling all purchases. Simple to calculate, and the only method allowed for mutual funds.

Dividend reinvestment adds complexity over time. Every DRIP purchase creates a new cost lot with its own basis and holding period. After 15 years of automatic reinvestment, you may have hundreds of lots — each potentially taxed at a different rate. Most brokerages track this automatically now, but older accounts sometimes have gaps in records that require reconstruction.

When you sell a partial position, only the basis of the sold shares affects your tax return.


Ad Space — Bottom Banner

Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.