can I use loss carry forward to offset capital gain from sale of second home?

I sold 2 homes in 2022 and realized a large capital gain on the sale of my second home. Can I use a loss carry forward from prior years to offset the gain?