Capital gain
The profit on an asset worth more than it cost, measured as value minus the cost basis. The gain is unrealised while you hold the asset and realised, at sale proceeds minus basis, once you sell.
A capital gain is what is left when you subtract an asset's cost basis from what you sold it for. The basis is the purchase price plus the costs of acquiring it, adjusted afterwards for items like reinvested dividends and fund distributions. Sell below the basis and the same subtraction produces a capital loss instead.
The distinction that matters is realised against unrealised. A holding that has doubled but has not been sold carries an unrealised gain, often called a paper gain, and in the United States there is normally no tax until the sale, which makes the timing of a sale a decision with tax attached to it. Realised losses can be set against realised gains, which is what tax-loss harvesting is for, and there are limits on how much net loss may be applied to other income in one year.
Holding period matters as well. In the United States, an asset held longer than a year usually counts as long term, and the capital gains tax on it is lighter than on a short-term gain, which is treated as ordinary income. The rates and thresholds sit in tax law and are revised from time to time, so the structure is the part worth learning.
The expensive mistake is losing the basis. Reinvested dividends were already taxed in the year they were paid, and each one bought more shares and lifted the basis, so an investor who reports only the original purchase price pays tax twice on the same money. Brokers in the United States report basis for most holdings bought in recent years, but older positions, gifted holdings and transferred accounts often carry a basis only the owner can reconstruct.