When we get cold, sometimes our bodies start moving—even if we don't mean for them to. Our teeth chatter, and different parts of our bodies shake and quake, no matter how still we try to stay. Brr!
Shivering is one of several ways the body tries to keep warm when it's cold out. It’s part of a process is called homeostasis, which means that your body wants to keep things consistent. In other words, your insides need to stay about the same temperature, no matter how hot or cold it is outside, and shivering helps make that happen.
When your warm body (which is about 98.6° Fahrenheit) is exposed to cold air, the heat from your body flows into the air. This is because heat always flows from a hot object to a cold object, as a way of balancing out the differences in temperature. It’s like when you put a pot of water on the stove, and the hot fire warms the cold water. Only in this case, you’re the fire, and the heat from your body is warming up the air around you. If the air is cold enough to steal your body heat, you feel cold. To make up for all the heat you’re losing to the cold air, your body shivers to try to produce even more warmth.
If you can’t keep your body warm enough by wearing warm clothes or moving closer to the heater—say, if you go outside in a t-shirt on a snowy day—your body will try to make as much heat as it can on its own. When you shiver, your muscles tighten and relax over and over again in a short amount of time. The energy that it takes to make your muscles do that gives off heat, keeping your body a little warmer than it would otherwise be—although you might still feel chilly standing in the snow in your t-shirt. You'll warm up much quicker if you put on a coat than if you expect your body to do all the work by itself!