Short and Long Term Capital Losses from previous years. how much can offset *gains from **this** year*

Hi All

From prior years, 2020 and 2022, i have capital losses that were never applied as offsetting.  i believe it's called "carryover" when they're not used.  It's about 50K.  I have significantly *less* SHORT term capital gains only going this year, 2023, i think about 25K USD at this point.  

I can use all of those prior years 50K losses to zero out this 25K gain from this year for capital gains tax elimination purposes, correct?  thanks!