This Fourth of July, millions of Americans are going to toast to breaking up with England back in 1776 with an ice cream sandwich.

The classic dessert, like the great nation that birthed it, is the paragon of courage, remaining steadfast as its mortal enemy literally brings the heat. Do ice cream sandwiches shrink beneath an oppressively hot sun? Do they cower in the midst of scorching temperatures? Of course they don’t. As you stand beneath a sky strewn with red, white, and blue this weekend, cradling an ice cream sandwich between your liberated fingers, take a moment to consider its strength. Consider, for a moment, its tenacity. If you listen closely enough, you might hear its battle hymn: I will not melt.

Ice cream sandwiches weren’t always praised for their steadfastness. In 2011, a sea of haters decried their integrity, calling their ability to withstand the heat “artificial” and “weird.” Some even dared to suggest they were not made of real ice cream. But the ice cream in ice cream sandwiches, like America, is a complex amalgam of constantly shifting parts, some of which are more supportive than others (more on that later). Taken as a whole, it is (according to the federal ice cream guidelines) still ice cream.

Steadfast, like America. 

So why won’t they melt while their cone-bound cousins do? If you ask Richard Hartel, Ph.D., a professor of food engineering at the University of Wisconsin-Madison and co-author of Ice Cream, a textbook referred to as “the Bible of ice cream,” he’ll tell you that America’s simplest pleasure is deceptively complicated.

“Ice cream is probably one of the most complex food products that we have,” he said in a seminar on the frozen dessert hosted by the American Chemical Society. He explained that elements like ice content (the amount of water ice in the mixture) and the thickness of the serum phase (what’s in the actual ice cream solution) all factor into the rate at which it melts — or in this case, doesn’t.

But in the case of our brave, seemingly unmeltable ice cream sandwiches, there’s one crucial, very American component that plays a huge role: Fat.

The discrete droplets of fat in ice cream, Hartel explains, are what give the dessert its structural strength. That’s because ice cream is an emulsion — a smooth, homogenous mixture of fat blobs suspended in a liquid, much like salad dressing when it’s well mixed. The spheres of milk fat in ice cream generally want to coalesce into larger globes, but allowing that to happen would result in a rapidly melting dessert. To prevent this from happening, fat blobs need to achieve “partial coalescence.” This is a delicate state of being — call it ice cream nirvana — in which the blobs come together but don’t entirely fuse, resulting in vaguely rigid clusters, interspersed throughout the solution, that give the dessert some integrity.

To achieve this tenuous balance, ice cream manufacturers can do a couple of things: They can play with the temperature of their freezers so that the fat inside the globules becomes somewhat crystalline, giving them some rigidity. Or they can add substances called emulsifiers that coat the fat spheres, making it harder for them to aggregate.

Keeping the blobs of milkfat too separate, however, results in unscoopable ice cream, and that’s no fun either. Because proteins coating the fat globules are especially good at keeping them apart, manufacturers also keep the amount of protein in the mix to a fairly low minimum (4 percent).

If it sounds complicated, that’s because it is. “The process of making ice cream is designed to get clusters of partially coalesced fat that provide some structure and standup properties to ice cream as it melts,” Hartel said in his talk.

So where does this leave ice cream sandwiches? Consider, for a moment, a classic ice cream bar, soft dairy clouds between softer cookies, sitting out in the sun. Up close, the ice cream is a matrix of milk proteins, sugars, and ice shards, propped up between the branches of the semi-rigid network formed by the partially coalesced fat globules. As the ice melts, it pulls smaller components down with it into an ice cream stream. The air bubbles deflate. But if there’s enough partially coalesced fat to build out a strong structure — as so many classic ice cream bars do — the rush of liquid won’t cause a total collapse. The ice cream may melt, but the structure never caves in.

Much like America, ice cream sandwiches can take the heat. That’s because what makes America great is all of its different parts, working together to support each other in a delicate balance, knowing all the while that the structures at its core are, well, partially coalesced. The same, we are proud to report, can be said of ice cream sandwiches.