Capital gains tax is generally payable when you dispose of a real estate interest. The main exception is when the real estate is your main residence.
In some circumstances, the real estate you dispose of may have initiall y been you main residence, but then you started to rent it out. In these circumstances, you may be eligible for an exemption, or liable for capital gains tax on real estate on a pro rata basis.
For your particular situation, you should talk to a professional tax advisor.