Capital gains tax

I bought my home in 2017. I recently sold it in May 2023. I rented it out the last 2 1/2 years.. well I have to pay capital gains tax? 

Thank you