Capital Gains Tax, Explained

After reading this you can compute the taxable gain on an investment you sold, apply the right tax rate, and read off both the tax due and the money you actually keep.

What capital gains tax is

When you sell an investment for more than it cost you, the profit is a capital gain. Most tax systems tax only that gain, not the entire amount you receive. If you buy shares for 10000 and sell them for 15000, the government does not tax the full 15000. It taxes the 5000 of profit, minus any costs you can subtract.

Here is a quick hook. Suppose you sell for 15000, your purchase cost was 10000, and you paid 100 in fees. Your taxable gain is 15000 - 10000 - 100 = 4900. At a 15% rate, the tax is 735, and you keep 15000 - 10000 - 100 - 735 = 4165 as net profit. The rest of this article shows exactly where each number comes from and where people get it wrong.

When to use this and when not to

Use a capital gains calculation when you have realised a gain: you actually sold the asset and received proceeds. Unrealised gains, where a holding rose in value but you still own it, are usually not taxed until you sell. That distinction matters because your paper profit can swing every day without any tax consequence.

Do not use this method for income that is taxed differently. Dividends, bond interest and rental income often fall under separate rules and separate rates. If you want to size a dividend stream instead of a sale, the Dividend Yield Calculator is the right tool. For the pure return on a trade before tax, see the ROI Calculator.

Tax rules on holding period, allowances, loss offsets and wash sales differ by country and change over time. The formula here gives a clean estimate. It does not replace your local tax code or a qualified adviser.

The formula and the intuition

The taxable gain is what you sold for, reduced by what you paid to own the asset and what you paid to trade it.

G = P - C - F

Here G is the taxable gain, P is the sale proceeds, C is the original purchase cost, and F is the fees and commissions. Fees reduce the gain because they are a genuine cost of the transaction, so most systems let you subtract them.

The tax due applies the rate r (as a decimal) to the gain, but only when the gain is positive.

T = r \cdot \max(G, 0)

The \max(G, 0) matters: if you sold at a loss, G is negative and you owe no tax on it. The calculator treats a negative gain as zero tax. Finally, the net profit is the gain after tax:

N = G - T

Net profit N is the money that stays with you. It already accounts for the original cost and fees, because those were subtracted inside G.

A worked example with the demo numbers

Selling for 15000 with a 15% rate

These are the tool's default values, so you can press the demo button and follow along.

  1. Start with proceeds P = 15000.
  2. Subtract the purchase cost C = 10000: that leaves 5000.
  3. Subtract the fees F = 100: the taxable gain is G = 4900.
  4. Apply the rate r = 0.15: the tax is T = 0.15 \times 4900 = 735.
  5. Net profit is N = 4900 - 735 = 4165.

So on a sale of 15000, your headline profit before tax was 4900, the tax took 735, and you kept 4165. The tax is 15% of the gain, not 15% of the sale, which is why it is 735 and not 2250.

The four slices of the 15000 you received: your cost back, the fees, the tax, and the profit you keep. They sum to 15000.

How the rate changes what you keep

The gain is fixed once you have sold. What changes with the rate is how much of that gain you keep. With the same 4900 gain, the table shows several rates you might face.

Tax and net profit on a 4900 gain at different rates
RateTaxNet profitKept share
0%04900100%
15%735416585%
20%980392080%
27%1323357773%

The kept share is simply 1 - r. At 15% you keep 85% of the gain, at 20% you keep 80%. Many systems set a lower long-term rate to reward holding an asset for longer, which is why the holding period is worth checking before you sell.

With proceeds of 15000, cost of 10000 and fees of 100, the gain is 4900. At a 0% rate you keep all 4900; at 15% you pay 735 and keep 4165; at 30% you pay 1470 and keep 3430. Higher rates take a straight-line larger slice of the fixed gain.

Reading and interpreting the results

The calculator gives you three numbers worth separating in your head.

Taxable gain
Your profit before tax, after cost and fees. This is the base the rate is applied to. If it is zero or negative, no tax is due.
Tax due
The rate times the positive gain. This is an estimate of what you owe, not a filed figure.
Net profit
What you actually add to your wealth from the trade. Compare this to the effort and risk you took, not the gross proceeds.

A common trap is to celebrate the proceeds. Selling for 15000 feels like a big number, but if your cost was 14000, the net profit at 15% is only (15000 - 14000 - 100) \times 0.85 = 765. The proceeds and the profit are very different quantities.

Common mistakes

Most errors here are small arithmetic slips with large consequences.

  • Taxing the whole sale. The rate applies to the gain, not the proceeds. Taxing 15000 at 15% gives a wrong 2250 instead of the correct 735.
  • Forgetting fees. Both the buying fee and the selling fee reduce the gain. Leaving them out overstates your gain and your tax.
  • Ignoring the holding period. A short-term sale may be taxed at a higher rate than a long-term one. The right rate is not always the first one you find.
  • Netting a loss incorrectly. A loss produces no tax in this calculator, but real systems often let you offset losses against other gains. That can lower your total bill in ways a single-trade estimate does not show.
  • Confusing rate formats. Enter 15 for 15%, not 0.15. Entering 0.15 would compute a tax of about 7.35.

Keep your buy confirmation, sell confirmation and fee statements together. The three numbers you need, proceeds, cost and fees, all come straight off those documents.

Related tools

Capital gains tax is the last step of an investment's life. Other tools help with the steps before it. To project how a lump sum or regular contributions might grow before you ever sell, use the Investment Growth Calculator or the Dollar-Cost Averaging Calculator. To measure the annualised speed of a gain between two dates, the CAGR Calculator is the direct fit.

If you bought the same asset at several prices, the Stock Average Price Calculator gives the blended cost you should enter here. For gains after inflation, the Inflation-Adjusted Return Calculator shows what your profit is really worth. Traders sizing entries can use the Position Size Calculator, and for coins specifically the Crypto Profit Calculator handles exchange fees and break-even.

Frequently asked questions

Is capital gains tax charged on the whole sale amount?

No. It is charged on the gain, which is proceeds minus cost minus fees. On a 15000 sale of an asset that cost 10000 with 100 in fees, the taxed amount is 4900, not 15000.

What happens if I sell at a loss?

The gain is negative, so this calculator shows zero tax. In many countries a realised loss can be used to reduce tax on other gains, but that offset is not modelled here. Check your local rules.

Which rate should I enter?

Enter the rate that applies to your situation. The help text lists examples such as Hungary at 15% and the US long-term rates of 0%, 15% or 20% depending on income. Short-term and long-term rates often differ, so confirm your holding period first.

Do fees really lower my tax?

In most systems, yes, because trading fees are a cost of the transaction. In the demo, the 100 fee cuts the gain from 5000 to 4900, which lowers the 15% tax from 750 to 735.

Are dividends included in this calculation?

No. This tool handles the gain from selling an asset. Dividends are usually taxed under separate rules, so estimate them with the Dividend Yield Calculator instead.