A Runny Egg Turns Solid in a Cookie Because Its Proteins Uncoil and Tangle
At about 144 degrees, dozens of egg proteins unfold and lock together, turning liquid into the scaffolding of the cookie.

TED-Ed · The chemistry of cookies - Stephanie WarrenBreak an egg into a bowl and it runs everywhere. Bake that same egg inside cookie dough and it turns firm, and holds the whole cookie together.
The change starts at about 144 degrees in the oven. Most of the protein in cookie dough comes from eggs, and an egg holds many proteins that react to heat at different points.
Fresh from the hen, those proteins look like coiled balls of string, each one wound tightly on itself. Heat is energy, and as that energy flows into the dough, the coils come undone. The strings unfold, stretch out, and bump into their neighbors.
Then they get tangled. One unfolded protein links with another, and another, until they form a connected mesh. That linked structure is what turns liquid egg nearly solid. In a cookie, it gives substance to what was a soft, squishy dough.
The cookie dries as water boils off at 212 degrees. The dough loses moisture and firms up, and cracks open across the top. The escaping steam leaves behind tiny, airy pockets that help make the bite light and flaky, along with gas released by baking soda.
That is how the runny part of the egg becomes the firm scaffolding inside the cookie, one uncoiled string at a time.
Questions people ask
Do egg whites and yolks do the same thing in baking?
No, they act differently because they have different mixes of proteins, fats, and water. Whites are almost all water and protein, so they set firm and can trap air, while yolks contain fat and emulsifiers that add richness, color, and tenderness. That is why recipes sometimes call for only one or the other.
Can you make a cookie without eggs?
Yes, but you have to replace both moisture and structure. Mashed banana, applesauce, yogurt, or commercial egg replacers can add moisture, while extra fat or starches can add tenderness and binding. The texture is usually denser, softer, or cakier because no other ingredient forms quite the same protein mesh.
Why is the center of a cookie still soft when the edges look done?
Heat moves from the outside in, so the edges reach protein-setting and drying temperatures first. The center is still cooler and holds more water, so its protein network is weaker and less dried out. As the cookie cools, the center firms up as starches set and some remaining moisture redistributes.