equity capital loss

i have incurred a equity capital loss of 22k in 2023 . Now in 2024 I have 15k profit. can i cover whole profit of 15 k with last year loss and not required to pay any additional capital gain tax in 2024 . for US tax return?