WASHINGTON — The number of US farms is declining even as the value of their crops and livestock has increased over the past five years, a government census of American agriculture released Thursday says.
The survey, taken every five years, shows there were 2.1 million farms in the United States in 2012, down a little more than 4 percent from 2007. That follows a long-term trend of declining numbers of farms.
Also, farmers are getting older — the average age was 58.3 years. But Agriculture Secretary Tom Vilsack points to a bright spot: a small rise in the number of farmers between 25 and 34 years old.
Vilsack says the boost in the number of younger farmers is partly due to increased interest and government support for locally grown foods and a thriving export market. Many younger farmers work at smaller operations, where the boom in the farm economy and a rising consumer interest in where food is grown have helped them.
That boom has been good to all of farm country: According to the survey, the market values of crops, livestock, and total agricultural products were all at record highs. Farms in the United States sold almost $395 billion in products in 2012, 33 percent higher than in 2007.
Still, farmers are aging. According to the census, a third of farmers were older than 65 in 2012.
‘‘The reality is, over time those folks won’t be able to continue farming, and the question for all of us is, if they don’t, who will?’’ Vilsack said after the report was released.
Vilsack has made the revitalization of rural America a priority at USDA. As people have moved to suburbs and cities, many communities have increasing poverty and fewer young people to take over family farms.
He has also argued that the dwindling population has led to less political clout — made evident by a recent three-year congressional struggle to enact a new farm bill. President Obama signed the bill, which provides farm subsidies and food stamps, into law earlier this month.
‘‘My question is not just who is going to farm, but who is going to defend them?’’ Vilsack said.
The amount of farmland in the United States also shrunk over the time period, from 922 million to 915 million acres. At the same time, farms grew larger — the average farm grew from 418 to 434 acres.
Vilsack said he is most concerned about the survival of middle-sized farms, which declined in the last five years. The number of larger and smaller farms held mostly steady.
He said he believes that decline partly came from a lapse in disaster assistance while Congress haggled over the farm bill, drought in many states, and rising feed costs.
Ideally, he said, many of the younger farmers who are working on smaller farms will eventually expand their operations.
One area of growth for agriculture is farms that are minority-operated. The number of farms operated by Hispanics, African-Americans, American Indians, and Asians all grew between 2007 and 2012, and the number of Hispanics who were principal operators of farms grew by 21 percent. Still, farm country remains overwhelmingly white — 92 percent of farms are operated by whites, while less than 64 percent of the general population is white and the minority population is growing.
Similarly, only 14 percent of farms are operated by women, and more than 90 percent of those were smaller farms.
The survey also found:
■ Most US farms are small: 75 percent had sales of less than $50,000 in 2012.
■ Agricultural sales per farm averaged $187,000 in 2012, an increase of $52,000 — or 39 percent — over 2007.
■ New England, Texas, Florida, and many states in the Mountain West saw increases in the number of farms and some saw an increase in farmland. Many Midwestern, Southern, and Mid-Atlantic states saw decreases. Vilsack said much of the growth in those states comes from an increase in specialty crops, mostly fruits and vegetables, that are increasingly popular with consumers.