Figuring out capital gains in the stock market involves looking at the profit or loss from selling stocks. This means considering what you paid for the stocks, including the cost per share and any extra fees. You calculate the capital gain or loss by taking away the selling price from the purchase price, giving you the total revenue from selling the stocks.