A capital gains tax is a tax on the profit you realize when you sell a capital asset, such as a stock or real estate, for more than the purchase price. The amount of the tax you owe depends on the amount of the gain, the length of time you owned the asset, and your tax bracket. In the United States, the capital gains tax is a federal tax, and the rate can vary depending on your income and the type of capital asset you sold.