I have owned a home for the last 25 years that I raised my family in. I moved to another home about two years ago; however, my son and granddaughter live in the home. Am I sheltered from capital gains tax on sale of the home as long as my son stays in residence? Or does it depend on my residence?
Your son living there has no bearing on this. If the legal property owner lived in the residence as their primary residence for at least 2 of the last 5 years they owned the property, then the legal property owner can exempt up to $250K of the gain from taxes when they sell. ($500K if married filing joint, and the spouse meets the "2 of last 5 years" requirement also.)
Note that for the "2 of last 5" rule, that breaks down to it having been your primary residence for at least 730 days of the last 1826 days you owned the property, counting back from the closing date of the sale.
Here's the IRS rule on the capital gains exclusion:
You're eligible for the exclusion if you have owned and used your home as your main home for a period aggregating at least two years out of the five years prior to its date of sale.
@PlainGreenGregory you are sheltered from capital gains tax until you sell the home (or it passes in your estate). From what you state, if you continue living elsewhere, you will not be able to satisfy the "2 of the last 5 year" rule. The fact that your son lives in the home doesn't protect you.
Let's break that down. You never pay capital gains tax until you realize the gain by selling the property.
However, if you want to use the personal capital gains exclusion of $250,000 (or $500,000 if married filing jointly), you will have to sell the house within 3 years of when it stopped being your main home. You don't get an extension of the deadline for allowing family to live there.