An anonymous donor has given half a million dollars to fight student hunger on community college campuses in California.

The money will go to stock up campus food pantries with fresh produce, bread and soup at the 25 neediest community colleges in California, the chancellor’s office announced on Friday.

”There’s never been a donation like this for this purpose,” said Paul Feist, vice chancellor for communications. “We’re very grateful.”

The donor made the gift immediately after hearing college leaders make a presentation about a month ago about widespread hunger among community college students and how it contributes to poor grades, poor health and poor job prospects. According to a recent survey, half of all community college students have experienced “food insecurity” — the modern term for hunger.

Which colleges will get the money will be decided in coming weeks based on a review of college demographics — the campuses getting the money will have the highest percentages of economically challenged students, Feist said. The system’s 115 colleges serve 2.1 million students.

The money will replenish supplies of produce, canned goods, bread, soup, snacks and other commodities offered at no charge to students at the college pantries, or food banks.

“It is crucial that we provide our students with the support they need to achieve their educational goals,” said California Community Colleges Chancellor Eloy Ortiz Oakley. “We appreciate the donor’s action to address the emerging crisis of student hunger on our campuses. Gifts like this can have tremendous impact.”

Campus hunger is receiving increased attention in Calilfornia. The state budget this year includes an additional $500,000 to study “initiatives to combat food security” — although not to buy students anything to eat.

Steve Rubenstein is a San Francisco Chronicle staff writer. Email: srubenstein@sfchronicle.com Twitter: @SteveRubeSF