Capital gains on house when refinanced before ever rented out. ie. bought/lived in house; refi; lived in house; rented house; sold house. Where is baseline for gains?

Purchased and lived in home 2001

Refinanced in 2004.

Moved out of home in 2011 (married)

Rented house out in 2012

Sold house in 2017

Determine capital gains based upon 2001 price or 2004 refinance.

The question is due to capital gains of selling an income property seemed to be due to increase in value of property.  The increase of this property was the increase since the refi, not since purchase as that increase was increase in value of main home.