Get your taxes done using TurboTax

@mageshcmouli - let's continue the example.  As you are carrying over $22k of losses, let's say you had $15k of gains.  There would be no capital gains tax, as the losses and the gains would net to zero, but you would still have a $7k carry loss forward.  $3,000 would be applied to ordinary income and you'd carry forward $4,000 to 2024.