The basic rule is that you are exempt from CGT on a gain from selling your “main residence”. You can only have one main residence at the same time (and if you are married or in a civil partnership, you can only have one between the two of you).
There is one exception to this rule - if a property has been your main residence at any time during your ownership of it, then this exemption extends to the last 36 months before you sell it, even if in fact you have another main residence during that period.
The idea of the legislation is to take account of the fact that you may need to buy a new home before you manage to sell the old one, but it provides an opportunity for some useful tax planning.
If you have more than one “residence”, the law allows you to nominate which one is to be treated as your “main residence” for tax purposes and so enjoy the exemption from CGT. You must do this within two years of it becoming necessary to decide which is your main residence.
Once you have made this nomination, by writing to the tax office that deals with your tax affairs, you can subsequently vary that nomination at any time in the future, and the variation can be backdated by up to two years. In the case of a married couple or civil partnership, both must sign the nomination and any subsequent variation.
Joe lives in Devon with his family, in an old farmhouse. He gets a job in London, and buys a small flat there where he lives during the week. He (and his wife) writes to the tax office, nominating the farmhouse as their “main residence”.
Three years later, Joe decides to sell the London flat, which has increased in value by say £50,000. He and his wife write to their tax office and vary the nomination of their main residence in favour of the London flat, with effect from (say) 1 April 2009. A few weeks later, they write again, and vary the nomination back to the Devon farmhouse, with effect from 1 May 2009.
Because the London flat was properly nominated as their “main residence” for one month (April 2009), the last 36 months of the gain (so in this case, all of it) are exempt from CGT.
The Devon farmhouse has lost only one month of exemption, so if it were sold after they had owned it for ten years, only 1/120 of the gain would be taxable, and that would almost certainly be covered by their CGT annual exempt amounts (£10,200 each for 2009/10).