Yes, your will should still be valid. However, if your ex-spouse or civil partner was appointed as an executor of the will or if they were to inherit property from you, they will be treated as though they had died on the day your marriage or civil partnership ended. The practical consequence is that they cannot act as executor and they do not inherit.
Although your will is still valid, getting divorced could be a the perfect time to review it, especially if you had previously planned to leave a large amount of your estate to your ex-spouse or civil partner. There may be a number of other arrangements in your will which may benefit from being updated at this time too, such as considering how no longer being married could affect your inheritance tax liability, your executors and of course, your beneficiaries.
Find out more in our ‘Getting divorced and your will’ article.