Skip to content
Investment Math
Investment Math

Currency and number style

Only changes how amounts look. There is no currency conversion.

Capital Gains Tax explained: formula, worked example and common mistakes

Match a sale against every purchase lot and follow the whole tax working, table by table. Free, no sign-up, your figures never leave the browser.

Updated

What the capital gains calculator works out

A real sale is one price against several purchases, and the tax depends on which purchases it is matched against, how long each was held, what losses are waiting, and which route the law gives the asset. The calculator runs that whole pipeline: the FIFO match across every lot, the long-term and short-term buckets, the yearly exemption on long-term equity gains, the loss set-off in its legal order, the rates by asset class, the levy — and the two-way comparison for property bought before the 2024 cutoff, both rows shown.

You type the sale as one line, the purchases as one line each, the losses and any claimed exemption, and the rates — every one an editable field with its date.

The formula

Each matched line, FIFO first:

gain = qty × (sale price − cost) − sale expenses × qty share − lot expenses

bucketed by the days held, against a threshold of 365 days for the equity class and 730 outside it. Then, in order:

long-term equity taxable = gain − the yearly exemption − losses − the claimed exemption
tax = each taxable slice at its own rate, then surcharge, then the levy

The indexed route for pre-cutoff property reads the cost through the two years’ index figures before the twenty per cent rate.

A worked example

The page opens on this run: 150 shares sold at 1,500 on 10 October 2026, with 2,000 of expenses, against 100 shares bought at 500 in June 2023 and 100 at 1,000 in December 2025.

FIFO: lot 1 fills all 100 shares — held well past 365 days, long-term
      lot 2 fills the remaining 50 — held under a year, short-term
long-term gain = 150,000 − 50,000 − 1,333.33 = 98,666.67
short-term gain = 75,000 − 50,000 − 666.67 = 24,333.33
exemption used = 98,666.67 of the yearly slice; nothing left to tax there
short-term tax = 24,333.33 × 20% = 4,866.67
levy = 194.67        total = 5,061.33

The headline reads: total tax 5,061 — 98,667 long-term, 24,333 short-term. Raise the sale price to 2,000 and the long-term gain climbs past the exemption: 23,666.67 becomes taxable at twelve and a half, the short-term slice at twenty, and the bill lands at 13,338 with the levy.

The match table underneath shows every line — dates, quantities, cost, proceeds, gain, bucket — so the working can be checked against contract notes, line by line.

What changes the answer

  • The match order. FIFO is fixed, which is why the purchase list runs oldest first, complete. A missing lot quietly moves gains between buckets.
  • The holding days. One day either side of the threshold moves a whole line’s rate.
  • The losses. They run before any rate applies, short-term first. An untyped loss is a tax paid that the law would have canceled.
  • The asset class. Equity, property, other and debt take genuinely different routes; the class field is the first thing to check.
  • The yearly exemption. It renews every year, which is what gain-harvesting lives on: book the slice, buy straight back, reset the cost tax-free.
  • The dates of purchase for property. Before the cutoff opens the two-route comparison; after it, one route only.

When to use it, and when not to

Use it before a sale, to price the buckets the sale will fill; after one, to check the figure a broker or a filing draft produced; and each year, to see how much of the exemption is still free. The tables are the working, and none of it is hidden.

It does not file anything, decide eligibility for the reinvestment exemptions, or read the grandfathering of old shares unless the 2018 values are typed against the lots. Its thresholds are day-count approximations of the month-based rules, stated as such on the page, and its rates are dated fields for sales on or after 23 July 2024 — the advanced switch reads the one early-2024-25 transition case.

Common mistakes people make

1. Selling against the whole holding in the head. Mental averages blur the buckets; FIFO decides them. List the lots.

2. Forgetting the losses sitting in the year. Set-off runs before any rate. An untyped short-term loss is money given away.

3. Using the wrong asset class. Debt bought after April 2023 has no long-term route at all; assuming otherwise overstates the exemption and understates the bill.

4. Treating the exemption as per sale. It is per year across everything. Two sales in one year share the slice, and the page says what remains.

5. Ignoring the 2018 values on old share lots. Without them the basis stays at cost; with them, the law’s kinder figure can apply.

6. Missing the levy in a hand check. The four per cent closes every bill here, and hand arithmetic that stops at the rate is short by exactly that.

Frequently asked questions

What rates apply to a sale now?

For sales on or after 23 July 2024: listed shares and equity funds take twelve and a half per cent on long-term gains above the yearly exemption and twenty on short-term; land and buildings take twelve and a half long-term with the indexed choice for pre-cutoff purchases; a debt fund bought after April 2023 pays at your slab whatever the holding. Every rate on the page is a dated field.

Why does the calculator match lots?

Because a sale is rarely against one purchase. The match runs oldest first, the way a demat account sells, and each matched line lands in a long-term or short-term bucket by the days it was held. The order can change the bill, so the page shows it.

How does the yearly exemption work?

The first slice of long-term equity gain each year is exempt before any rate, and it renews every year. The page shows how much of the year the sale used and what is left free.

How do losses set off?

Short-term losses go against short-term gains first and then long-term; long-term losses only ever touch long-term. Losses carried from earlier years wait until this year have run. The waterfall table shows each step.

What is the property comparison?

For land or a building bought before the cutoff by a resident individual or a family account, two routes are worked: twelve and a half per cent on the plain gain, and twenty per cent on the gain after the cost is indexed by the two years figures. The cheaper runs, and both rows are shown.

Are debt fund gains always at the slab?

For funds bought on or after 1 April 2023, yes: no long-term rate and no indexation, whatever the holding. Choose the debt class and the slab field does the work.

This tool shows math, not advice.

Cite this page

Copy this line into a reference list, a report or a spreadsheet note.

Investment Math Calculator. “Capital Gains Tax Calculator”. Updated 2026-11-08. https://investmentmathcalculator.com/guides/capital-gains-tax-calculator/

Disclaimer: For education only. These calculators show arithmetic and hypothetical scenarios. They are not investment, tax or legal advice and do not recommend any security or product. Consult a licensed adviser in your country before acting.