American hens produce more than 83 billion eggs a year. Most hens — more than 285 million in all — are housed in cages not much bigger than a shoe box. Stuck in one of these so-called battery cages, a hen might live her whole life without seeing the sunlight, let alone stretching her wings.

Pressure from animal rights activists has led many of the biggest food companies in the country to commit to what are being described as more humane alternatives. In recent months, Walmart, Costco, McDonald’s and others have pledged to transition to buying only cage-free eggs in the years to come.

That is music to the ears of the people who have campaigned against conventional battery cages. Yet while industrial cage-free systems may improve the quality of life for some hens, research suggests that they can also introduce health and environmental problems.

“The world is changing,” said Wayne Pacelle, president of the Humane Society of the United States. “There is this rising tide of consciousness about animals, and people are starting to realize that they have feelings and lives that matter.”