According to gov.uk, if someone has sold, gifted or downsized to a less valuable home before they die, their estate may still be eligible for the residence nil rate band (RNRB). However, the following conditions must be met to qualify:
The person gifted, sold, or downsized to a less valuable home on or after 8 July 2015.
Their former home would have qualified for the RNRB if they’d kept it until they’d died.
Their direct descendants inherit at least some of the estate.