Berkeley ranks as the third-best city to live in nationwide, according to a new 2018 review by the website Niche.

According to Niche, Berkeley scored an A-plus in categories ranging from quality of public schools to nightlife, weather, commute and living situation for families. It also came in first as the “healthiest” city in the United States. But the city scores lower in other criteria, such as crime and safety, housing and cost of living.

“Berkeley has wonderful weather: very mild winters, cool summers, no rain in the summer. This is definitely top-five weather,” said Mike Zint, co-founder of homeless rights activist group First They Came for the Homeless. “Housing? Only if you are doing well — the cost is too high.”

According to the Niche website, rankings are based on rigorous analysis of key statistics from the U.S. Department of Education and the U.S. census, as well as millions of reviews by Niche users.

Berkeley residents, for example, were ranked based on ethnic and economic diversity. The median household income was recorded as $70,393, higher than the national average, and the percentage of residents with university degrees also exceeded that of the nation.

The “higher education rate” counted for 12.5 percent of the final rankings, whereas cost of living and violent crime rates received 10 percent and 5 percent weightings, respectively.

The city received its lowest ranking — a D-plus — in the “cost of living” category. Both Zint and homeless advocate Guy “Mike” Lee criticized the city’s policies, saying that they favored wealthier citizens and that more should be done to build affordable housing.

“We have an ever-increasing homeless population due to inaction of public policy beyond a bologna sandwich and a pat on the head,” Lee said.

Lee also predicts a “crime wave,” attributing a potential rise in crime to poor living standards and a shrinking police force. Niche based the ranking for the “crime and safety” category on violent and property crime rates. According to the website, the rates for robbery, burglary, theft and motor vehicle theft exceeded those of the nation.

San Francisco, Irvine and Sunnyvale also ranked among the top 20 cities to live in. Only Ann Arbor, Michigan, and Naperville, Illinois, outranked Berkeley in the review.

Although City Councilmember Kriss Worthington said he approved of Berkeley’s ranking, he noted that the high rating encourages many people to move to the city and could contribute to increased housing costs. He added that the city must work to reduce its violent crime as well as build more affordable and student housing.

“I think if we could fix those two things, we could probably be No. 1 — best city in the whole country,” Worthington said.

Contact Jenny Weng at [email protected] and follow her on Twitter at @jennyweng1999.