A capital gains tax is a levy on the profit that an investor makes from the sale of an investment such as stock shares. Here's how to calculate it and minimize it.| Investopedia