← All text tools

Cost Basis Calculator

List your share purchase lots and a sale to get the cost basis, gain or loss and lots used under FIFO, LIFO and average cost, side by side.

  • Free
  • No sign-up
  • Works on any device

About Cost Basis Calculator

When you sell part of a holding bought in several lots, the cost basis you assign decides your gain. FIFO sells the oldest lots first, LIFO the newest first, and average cost uses the total cost of all lots divided by all shares. List your lots as date, shares, price and optional fee, then enter the shares sold, price and date. Selling 120 of lots of 100 at 10, 50 at 14 and 50 at 20 for 25 gives a gain of 1,720 under FIFO, 1,100 under LIFO and 1,380 on average cost.

How to use Cost Basis Calculator

  1. Type each purchase lot on its own line as date, shares, price per share and an optional fee.
  2. Enter the number of shares sold, the sale price, the sale date and any selling fees.
  3. Read the cost basis, the gain and the lots used, and compare FIFO, LIFO and average cost.

Why use this tool?

Also known as

Frequently asked questions

Which cost basis method should I use?

It depends on what your tax authority and broker allow. FIFO is the usual default, while some countries require average cost. Check the rules before choosing, because the method changes your taxable gain.

Are fees included in the cost basis?

Yes. A fee on a purchase lot is added to that lot's cost, and fees on the sale reduce the proceeds. Both lower the taxable gain.

How does the page decide long-term and short-term gains?

It counts days between each lot's purchase date and the sale date and calls more than 365 days long-term. Local holding period rules differ, so treat the split as an estimate.

Is Cost Basis Calculator free?

Yes. Cost Basis Calculator on Toolipedia is free to use, with no sign-up and no watermark.

Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.

Can I put Cost Basis Calculator on my own website?

Yes. Use the Embed on your site button under the tool to copy a short piece of code and paste it into your page. It is free, needs no account, and the tool keeps working inside your page.