Capital gains tax

Bought a house in April 2014 lived in it  (primary residence) until April 2018. Rented it out from 2018 until December 2019. Sold it in January 2020.

Im April 2018 bought a new home and made it my primary residence until July 2020 when I sold it.

Which one or both came be excluded from capital gain tax or how could I work it out?