I participate in my Canadian company's ESPP whilst living and working in Canada as a permanent resident. I'm moving back to the UK in August and will sell my shares when I'm back in the UK. Will the profit I make be assessed under Canada or UK CGT?
Both. The date of your becoming a non-resident of Canada for tax purposes (and that can be a complex thing to determine) there will be a deemed disposition of your shares. At that point any capital gain or loss subsequent to that point would be just a HMRC matter and the FMV on that date would be the whatever the Brits have as an analogue to an adjusted cost base.
The UK-Canada tax treaty (see article 13) distinguishes between shares sold on a recognized exchange and otherwise and things like what percentage of the total shares you own.
It is possible that you could be still be deemed resident of Canada for tax purposes and at the same time become resident of the UK for tax purposes. It isn't clear if that is actually the case, or at least I couldn't figure it out but that isn't much of a standard to go on.
If that is the case then there could be a brief time of overlap where the capital gains or losses could be subject to taxation in both jurisdictions.
When you leave Canada, you are considered to have sold certain types of property (even if you have not sold them) at their fair market value (FMV) and to have immediately reacquired them for the same amount. This is called a deemed disposition and you may have to report a capital gain (also known as departure tax).
Your property could include the following: shares, jewelry, paintings, or a collection.
For more information, go to Dispositions of property."