Click here if you are unable to view this gallery on a mobile device.

The heart of the nation’s tech sector, the astronomically expensive Santa Clara County, leads the state in residents looking to move out of town, a new report found.

Using property searches and census data, analysts at realtor.com found that a larger share of residents are leaving Santa Clara County — home to tech behemoths Google and Apple — than any other county in California. Nearby San Mateo County, where Facebook is headquartered, came in second, just ahead of Los Angeles County.

“They’re looking for affordability and not finding it in Santa Clara County,” said Danielle Hale, chief economist for realtor.com.

The Bay Area has long been a costly place to live, but a tight housing supply paired with an unprecedented economic boom pushed rents and real estate even further out of reach for all but the most affluent residents. Low- and middle-income families and younger workers unable to find apartments or houses they can afford have been forced further afield, a trend that has led to ultra-long commutes and perennially clogged freeways.

The crisis has inspired a flurry of state legislation to spur enough new housing construction to slow and eventually lower prices, including a sweeping proposal to add millions of homes by public transit. It died in April, but its author, Sen. Scott Wiener, D-San Francisco, has vowed to try again next year.

Instead of staying put, many Santa Clara County residents are decamping for Alameda, Sacramento, San Joaquin or Placer counties, looking at homes that are $509,000- $894,000 less than the Santa Clara median price of $1.28 million or leaving the state altogether and moving to Arizona, Nevada, Idaho or Texas for even better deals.

This was the first time realtor.com conducted such an analysis, which did not analyze the patterns by age. But Hale said it appears that the increased property searches outside of Silicon Valley are at least partly driven by millennials — roughly spanning the ages of 22 to 37 — determined to get a foothold in the housing market, even if it means moving.

While workers have flocked to the Bay Area for high-paying jobs, a recent report from the Joint Venture Silicon Valley think tank found that nearly as many people are leaving as are coming in.

If millennials and others continue to leave the Bay Area in search of affordable homes, Hale said, “It could eventually lead to the slowing of the frenzied pace of the housing market.”

The top out-of-state destinations for the South Bay exodus are the areas in and around Phoenix, Arizona; Reno and Las Vegas, Nevada; Austin, Texas; and Boise, Idaho — where homes are $750,000 to $965,000 less than the typical property in Santa Clara.

Start your day with the news you need from the Bay Area and beyond.

Sign up for our new Morning Report weekday newsletter.

The report also reveals the ripple effect of such migrations and their upward pressure on home prices. Take Alameda County, one of the top destinations for people fleeing the South Bay — but also #6 on the California exodus list: As prices in the East Bay city skyrocket, many are moving east to Contra Costa, San Joaquin, Sacramento and Placer counties in search of cheaper housing.

Meanwhile, the median home price in Sacramento County — $357,000 — has risen each month for the past six years, the Sacramento Bee reported last week, jumping by 12 percent in the past year.

Top 10 California counties that people are leaving

1. Santa Clara County

Out of state destinations: Arizona, Nevada, Texas and Idaho

In state destinations: Alameda, Sacramento, San Joaquin, Santa Cruz and Placer counties

2. San Mateo County

Out of state destinations: Arizona, Nevada, Texas and Washington

In state destinations: Alameda, Contra Costa, Santa Clara, Sacramento, and San Francisco counties

3. Los Angeles County

Out of state destinations: Nevada, Arizona, and Idaho

In state destinations: San Bernardino, Riverside, Ventura and Kern counties

4. Napa County

Out of state destinations: Arizona, Idaho, Nevada, Florida and Oregon

In state destinations: Solano, Sonoma, Sacramento, Lake and El Dorado counties

5. Monterey County

Out of state destinations: Arizona, Nevada, and Idaho

In state destinations: San Luis Obispo, Fresno, Santa Cruz, Sacramento and San Diego counties

6. Alameda County

Out of state destinations: Arizona, Nevada, Idaho, and Hawaii.

In state destinations: Contra Costa, San Joaquin, Sacramento, Placer, and El Dorado counties

7. Marin County

Out of state destinations: Nevada, Arizona, Oregon and Idaho.

In state destinations: Sonoma, Contra Costa, Solano and San Francisco counties

8. Orange County

Out of state destinations: Arizona, Nevada and Idaho

In state destinations: Riverside, Los Angeles, San Bernardino, San Diego and San Luis Obispo

9. Santa Barbara County

Out of state destinations: Arizona, Nevada and Idaho.

In state destinations: San Luis Obispo, Ventura, Los Angeles, Riverside and Kern counties

10. San Diego County

Out of state destinations: Arizona and Nevada

In state destinations: Riverside, San Bernardino, Imperial, Orange County and Los Angeles

SOURCE: Report from realtor.com.