As the egg moves down the oviduct, it enters the shell gland, or uterus. This is where the shell is formed. The shell gland secretes calcium carbonate, which is the main component of eggshells, onto the surface of the egg. The calcium carbonate gradually builds up, layer by layer, until the eggshell is fully formed.
The eggshell also contains proteins and other minerals, which help to give it strength and flexibility. The color of the eggshell is determined by the breed of chicken.
Once the eggshell is fully formed, the egg is laid. The shell then hardens further as it cools.