If you have always lived in your home as a private residence and not let any part or all of your home out, you receive 100% Private Residence Relief (PRR) i.e., no capital gains tax is payable on sale.
If you have never lived in the property and always let it out, you receive no private residence relief and the whole gain will be subject to capital gains tax.
If you have not always lived in your home, other than allowed periods of absence e.g. working away, you must multiply the total gain by a fraction equal to the period you actually lived in the dwelling property as a main residence plus any allowed periods of absence plus any part of the final 9 months of ownership not covered by actual occupation or allowed period of absence, divided by the total period of ownership: that part of the gain will be exempt from capital gains tax.
For example
You bought a property 5 years ago as your main residence for £300,000 and then moved in with your partner and let your place out for another 5 years and then sold it for £400,000.
Gain is £100,000 but you spent £7,000 on legal costs including stamp duty and £3,000 on real home improvements (not repairs). Total net gain £90,000.
Private Residence Relief (PRR)
Your allowance for private residence relief (PRR) is i) Period of ownership and occupancy plus ii) the last 9 months of ownership even if you were not living there = 5.75 years i.e., 57.5% of total ownership.
This part of the gain is exempt from CGT. PRR = £90,000 gain X 57.5% = £51,750 of gain eligible for private residence relief.
The remaining 4.25 years i.e., 42.5% of the period of ownership is subject to CGT. i.e. gain £90,000 X 42.5% = £38,250 chargeable capital gain.
£38,250 chargeable gain less individual capital gains tax annual allowance £12,300 = £25,950 subject to capital gains tax.