Holding onto your home for a long period of time over the last decade meant a serious return on investment, especially in some of the nation's hottest housing markets. According to a new Zillow®analysis, out Wednesday, Oakland, Calif. and Portland, Ore. top the list of cities where home sellers saw the greatest return.

In Oakland, the typical seller in 2016 sold their home for an average of $590,000 after living in it for just over seven years, which is 78% more than what they initially paid. In Portland, the typical 2016 seller sold for about $145,000 more than what they paid nine years earlier, a 65% gain.

Nationally, it's financially advantageous to buy a home rather than rent if you plan on living in it for at least two years and one month, but staying much longer than that has really paid off. U.S. homeowners who lived in their home for about 7 ½ years gained almost $40,000 on the sale of their home -- 24% more than what they initially paid.

The housing market recovery has sent home values roaring higher in the past several years, especially in West Coast cities that are attracting people with well-paying jobs. Despite the opportunity to cash in on record-high home values, some homeowners choose not to sell because they don't want to become buyers in a competitive market.

Low inventory and strong demand are driving up home values in these popular markets, making it difficult for aspiring buyers to find a home, but providing a good opportunity for homeowners looking to sell.

Top 10 Cities Where Home Sellers Cashed Out on Record Home Values
Rank
City
Median Years
Owned

Dollar Gain on
Saleii

Annual Dollar
Gain on Sale

Percent Gain
on Sale

1
Oakland, Calif.
7 years 3 months
$ 235,000
$ 33,913
78.0%
2
Portland, Ore.
9 years 1 month
$ 145,026
$ 16,714
64.7%
3
San Jose, Calif.
9 years 8 months
$ 271,150
$ 30,562
56.5%
4
Denver
7 years 7 months
$ 119,500
$ 18,162
56.0%
5
Los Angeles
9 years 8 months
$ 200,000
$ 23,200
53.7%
6
Sacramento, Calif.
6 years 11 months
$ 82,500
$ 12,000
53.6%
7
Seattle
9 years 2 months
$ 185,000
$ 20,840
53.1%
8
Philadelphia
7 years 11 months
$ 40,225
$ 4,194
51.7%
9
New Orleans
8 years 7 months
$ 81,000
$ 10,475
51.5%
10
Boston
7 years 10 months
$ 182,500
$ 25,036
49.6%

"The housing market can change a lot in 10 years, and you see that reflected in this top 10 list," said Zillow Chief Economist Dr. Svenja Gudell. "Buying a home is one of the biggest financial decisions people will make in their lifetime, and it really paid off for sellers in these cities. Every city on this list has been growing extremely fast over the past decade, with the majority passing peak home value hit during the housing bubble. It's extremely difficult to time the market, but if you're a longtime homeowner in one of these cities, you could potentially see a great return on your investment."

Among Zillow's top 10 list, three cities have home values growing in the double-digits. In Seattle, home values rose 15.5 percent year-over year, the fastest growing among the list, followed by Boston and Sacramento, Calif.

City
Median Years
Owned

Dollar Gain
on Sale

Annual Dollar
Gain on Sale

Percent Gain
on Sale

Zillow Home Value
Indexiii (ZHVI)

ZHVI YoY
Change

United States
7 years 5 months
$39,900
$5,404
24.1%
$200,700
6.8%
Los Angeles, CA
9 years 8 months
$200,000
$23,200
53.7%
$632,000
7.6%
Philadelphia, PA
7 years 11 months
$40,225
$4,194
51.7%
$138,900
7.6%
Phoenix, AZ
6 years 6 months
$58,000
$8,916
34.5%
$215,800
9.5%
Las Vegas, NV
5 years 8 months
$39,666
$6,500
27.2%
$220,900
10.1%
San Diego, CA
8 years 11 months
$125,000
$16,444
33.3%
$583,300
8.4%
San Jose, CA
9 years 8 months
$271,150
$30,562
56.5%
$892,400
7.3%
Jacksonville, FL
5 years 9 months
$22,800
$3,850
22.4%
$153,600
10.8%
Fort Worth, TX
6 years 11 months
$40,500
$6,000
20.3%
n/a
n/a
Columbus, OH
7 years 9 months
$19,000
$2,323
16.3%
$129,900
8.7%
Memphis, TN
6 years 5 months
$6,800
$936
8.5%
$81,900
7.6%
Charlotte, NC
8 years 2 months
$30,500
$3,947
18.9%
$187,100
9.0%
Boston, MA
7 years 10 months
$182,500
$25,036
49.6%
$560,300
11.0%
Seattle, WA
9 years 2 months
$185,000
$20,840
53.1%
$690,300
15.5%
Baltimore, MD
3 years 5 months
$5,000
$938
5.4%
$122,800
3.7%
Denver, CO
7 years 7 months
$119,500
$18,162
56.0%
$385,600
9.0%
Nashville, TN
8 years
$61,450
$8,648
40.4%
$233,000
13.7%
Milwaukee, WI
8 years 1 month
$14,000
$1,270
15.0%
$108,200
9.1%
Tucson, AZ
7 years 7 months
$29,500
$3,100
23.1%
$165,600
8.2%
Portland, OR
9 years 1 month
$145,026
$16,714
64.7%
$416,700
5.0%
Omaha, NE
8 years 1 month
$21,000
$2,751
14.4%
$155,900
9.0%
Fresno, CA
7 years 3 months
$48,000
$6,156
42.4%
$215,900
9.9%
Sacramento, CA
6 years 11 months
$82,500
$12,000
53.6%
$305,200
10.9%
Mesa, AZ
7 years 6 months
$49,000
$5,808
33.8%
$224,800
7.0%
Long Beach, CA
10 years 1 month
$137,500
$16,452
43.7%
$557,400
6.8%
Virginia Beach, VA
8 years 8 months
$40,000
$4,822
20.4%
$260,200
3.8%
Colorado Springs, CO
8 years 5 months
$38,150
$5,201
29.0%
$254,600
9.4%
Atlanta, GA
7 years 1 month
$46,000
$8,372
26.9%
$212,200
9.5%
Miami, FL
5 years 8 months
$70,000
$13,832
37.4%
$300,800
1.5%
Oakland, CA
7 years 3 months
$235,000
$33,913
78.0%
$687,600
9.2%
Honolulu, HI
8 years 9 months
$115,000
$15,146
31.3%
$673,700
4.8%
Minneapolis, MN
7 years 2 months
$51,100
$7,058
28.9%
$238,300
8.2%
New Orleans, LA
8 years 7 months
$81,000
$10,475
51.5%
$168,200
-1.9%
Arlington, TX
8 years 5 months
$43,426
$5,031
32.8%
$180,900
7.8%