It’s one of the most jaw-dropping, least-known facts of American food production: to keep the egg industry running efficiently, hatcheries kill hundreds of millions of newborn male chicks every year.

And soon, it may not happen any more. Last week, the trade group United Egg Producers, which represents almost all of the egg industry in the United States, announced that it is committing over the next four years to new technology that will keep those chicks from having to be killed—by preventing them from ever being born.

The huge policy shift, which has the potential to reshape the egg industry, was negotiated and announced by The Humane League, a small farm-animal welfare nonprofit staffed by and focused on millennials. You might know them as the group that brokered Wal-Mart’s switch to cage-free eggs.

“It’s fantastic news. A landmark moment,” Ben Goldsmith, executive director of the animal advocacy nonprofit Farm Forward, who was not involved in the negotiations, tells The Plate. “And that they’re setting a goal of 2020 is extremely exciting.”

To understand what everyone is agreeing to, it helps to know a little about the egg industry. The sterile eggs we eat come from hens. Those mother hens are hatched from fertile eggs laid by an earlier generation of hens in giant industrial hatcheries. But when fertile eggs hatch, it’s in a roughly 50:50 gender ratio—and the egg business has no use for the male chicks.They don’t produce eggs and don’t have the right body structure to be grown for meat. So within hours of their birth, those male birds are disposed of, by electrocution, gassing, or grinding them up alive.

This has been happening for decades, because there was no way to tell the sex of a chick until after it hatched and could be examined by an expert “chick sexer.” (Yes, that really is a job.) But recently there has been political pressure in Europe to find a better method, and in the past two months, research teams in Germany and the Netherlands have achieved technologies that can identify the gender of a chick when it is only a few days into the 21-day incubation period, by laser-cutting a tiny hole in the egg, or inserting a needle, to sample the chick’s DNA.

View Images Identifying male embryos before they hatch may allow the unwanted eggs to be used for vaccines and pet food. Photograph by John MacDougall, AFP, Getty Images

That occurs at a point where the embryonic chicken has barely formed. “That’s well before any kind of sentience, or capacity for the chick to suffer, is present,” says David Coman-Hidy, The Humane League’s executive director.

The likelihood the technologies will quickly be developed commercially led United Egg Producers to make the commitment to stop the current practice of grinding male chicks by 2020. The trade group said in a statement Friday:

“United Egg Producers and our egg farmer members support the elimination of day-old male chick culling after hatch for the laying industry. We are aware there are a number of international research initiatives underway in this area, and we encourage the development of an alternative with the goal of eliminating the culling of day-old male chicks by 2020 or as soon as it is commercially available and economically feasible. The U.S. egg industry is committed to continuing our proud history of advancing excellent welfare practices throughout the supply chain, and a breakthrough in this area will be a welcome development.”

United Egg Producers said they would not be doing interviews on the decision.

The fate of male chicks has been simmering in the background of food industry decision-making for several years. It was part of the reason for the launch of Hampton Creek, makers of the very popular eggless products Just Mayo, Just Cookie Dough and Just Cookies, which are made from pea and sorghum protein. Unilever—maker of Hellmann’s and Best Foods mayonnaise— sued Hampton Creek, claiming it was not entitled to call its spreads “mayonnaise.” A year later the Food and Drug Administration ruled in Hampton Creek’s favor. (See “Mayonnaise Manufacturer Sues ‘Mayo’ Maker.”)

Separately, Farm Forward challenged Unilever with an in-your-face viral video campaign of chicks being rolled on industrial conveyor belts and dropped down garbage disposals. After the videos had been viewed about a half-million times, Unilever committed to changing the way it purchased the more than 350 million eggs it buys each year, and to work with the egg industry to change chick sexing.

Simultaneously, smaller egg producers have been trying to find a solution by using “dual purpose” birds, breeds in which the roosters are robust enough that they can be raised for meat instead of discarded. (See “Open-Sourcing Chicken: Breaking Free from Corporate Genetics.”) But that has not been considered feasible by the conventional egg industry so far because the quantities of birds involved are so huge.

Coman-Hidy predicts that converting to “in ovo” (“in-egg”) sexing could have a ripple effect through the conventional industry. “Once we have determined which eggs are male, they can actually be used in the egg supply chain, for things like vaccines or for petfood,” he tells The Plate. “That means we will see a large reduction in demand on the current laying flocks. And that means that, in addition to hundreds of millions of animals in the U.S. not being killed on the first day of their lives, we should also see a reduction in the number of animals needed on factory farms to begin with. We see it as a really positive step on those grounds alone.”