Most New Yorkers want to continue living in their city, but rising costs risk pricing them out, according to a new poll.

Sixty-five percent of city residents said they’d like to remain in the city, but only 50 percent of New Yorkers said they could afford to do so, according the survey, published by Quinnipiac University poll on Monday.

“Sure it’s a nice place to visit, and people do want to live here. At least most of us do. It’s our town, they say, and two-thirds of them wouldn’t want to move out if they could,” said Maurice Carroll, assistant director of the Quinnipiac University poll, in a statement. “But, if the city is nice, it’s not cheap. Half of New Yorkers say they can’t afford to live here.”

The poll, which surveyed 1,138 city voters via phone, suggests that more New Yorkers are happy with their quality of life, compared to results from the same poll last year. Forty-one percent rated the quality of life as “very good” or “good.” That’s up from 33 percent last year, which was the lowest percent measured since Quinnipiac first polled on the topic in 1997.

Affordability concerns vary by borough and ethnicity. At the height of housing concerns, 55 percent of Bronx residents say can’t afford to live there. In Manhattan, only 38 percent said they can’t afford living there—the lowest of the five boroughs.

Among black voters, 57 percent said they couldn’t afford city living. That’s 15 percentage points higher than the 42 percent of white voters who responded the same way. Hispanic voters landed in between, with 51 percent of Hispanics saying they couldn’t afford the city.

“There’s no question housing affordability is central issues of New Yorkers, particularly low in-come communities of color,” said Katie Goldstein, executive director of the housing advocacy group Tenants & Neighbors. “Many of our members are really scared about their futures and being able to stay in New York.”

Tenants & Neighbors has been advocating for the strengthening of rent laws on the state level. Goldstein said that the one million rent-stabilized apartments in New York City, which house about 2.5 million New Yorkers, could be better protected if that if the state would remove certain loopholes like “eviction bonuses,” which allow for a 20 percent rent increase in stabilized apartments following a vacancy.

“It’s a major source of harassment for tenants—there’s basically a price tag to get them out,” Goldstein said. That loophole, Goldstein continued, is especially taken advantage of in gentrifying neighborhoods where there are high concentrations of rent-stabilized apartments, like Flatbush, Washington Heights, Crown Heights, east and central Harlem and the Bronx.

City Comptroller Scott Stringer, who’s been reportedly considering a run against Mayor Bill de Blasio next year, said the housing crisis leads many city residents to believe they’re not “getting a fair shot.”

“Many New Yorkers believe our City is sliding backwards,” Stringer said in a statement. “We have a homelessness crisis that is spiraling out of control, and an unprecedented affordable housing crisis. People feel like they’re not getting a fair shot—and everyday families across the five boroughs feel squeezed.”

Melissa Grace, a mayoral spokeswoman, referenced de Blasio’s housing programs Mandatory Inclusionary Housing and Zoning for Quality and Affordability as part of what was described as a holistic approach to an affordable New York.

“It’s an expensive city, and that’s why the mayor’s taken on housing affordability like no mayor before him,” Grace said in a statement. “Couple that with his focus on increasing wages, job creation, and money-savers like providing universal pre-k, this administration has a laser-eyed focus on the needs of low- and middle-income New Yorkers.”