The capital gains tax is the tax levied by the government on profits made from the sale or disposal of capital assets.
While many define capital gains tax as the tax imposed on the profit made from the just the sale of capital assets, profit can also be made by disposing of capital assets in other ways.
This means that as soon as a capital asset is disposed of, no matter the method, if there is any profit made, a tax should be paid for that profit. Examples of these include insurance claims for capital assets that were stolen or destroyed, exchanging the asset for something else that is of higher value than the purchase price of the asset, etc.
In other cases, disposal of capital assets will result in net capital loss instead of capital gain. For example, giving a capital asset as a gift to someone (other than your spouse or charity) is considered disposal of capital asset but this will obviously mean no profit to the initial owner.
While this will not affect the value of that specific asset, it will affect your net capital gain for that year. What this means for your capital gains tax is that you can subtract the capital loss for the year to the capital gain for the year in order to pay a much lower tax on capital gains.
Not all countries impose capital gains tax and that each country has its own rules and rates.