Wealth

The 20 most expensive ZIP codes

If you think it's expensive living in Silicon Valley or Beverly Hills, try buying a place in Sagaponack, New York.

The median sales price for a home in the tony Hamptons village is more than $5.1 million, making it the most expensive ZIP code in the U.S. when it comes to real estate, according to PropertyShark.

An outdoor party at a home in Sagaponack, New York.
Getty Images

The analysis, which looked at median prices for homes that sold between January 2014 and May 2015, found the Eastern Long Island town was followed by Atherton, California, in Silicon Valley, and then Beverly Hills.

Read MoreThe problem with million-dollar Hamptons rentals

In total, California claimed four of the top five spots, and 14 of the top 20. New York claimed all the other top ZIP codes, with the exception of Miami Beach, Florida, which came in ninth.

The median sales prices for the top 20 ZIP codes were all higher than $2 million, with each of the top 10 coming in at or above $2.6 million—about 10 times the national average median home price, according to the U.S. Census Bureau.

See below for the full list.

Rank Zip code Media sales price Number of sales City
111962$5,125,000 30Sagaponack, NY
294027$5,050,000 115Atherton, CA
390210$3,221,250 578Beverly Hills, CA
490402$3,062,250 206Santa Monica, CA
594301$2,827,500 245Palo Alto, CA
610013$2,800,000 431New York, NY
710007$2,763,711 126New York, NY
892662$2,675,000 28Newport Beach, CA
933109$2,650,000 57Miami Beach, FL
1094022$2,600,000 392Los Altos, CA
1194028$2,450,000 93Portola Valley, CA
1293108$2,400,000 233Santa Barbara, CA
1310282$2,400,000 30New York, NY
1492067$2,350,000 211Rancho Santa Fe, CA
1592657$2,349,500 274Newport Coast, CA
1611976$2,337,500 146Water Mill, NY
1794024$2,302,500 368Los Altos, CA
1892661$2,300,000 92Newport Beach, CA
1990272$2,240,000 621Pacific Palisades, CA
2091108$2,134,000 228San Marino, CA