Bacteria exist on the surface of all eggs. Egg shells are porous, however there is a protective layer deposited around the shell of an egg when laid (which is why eggs can look wet when they are ‘just laid') often called the 'bloom' to stop bacteria from entering the egg through the pores.
This is the reason it is best not to wash eggs before storing them. During incubation or warm weather, bacteria multiply and can sometimes get through the shell and multiply within the egg. If you candle the egg, it will often have dark, irregular patches and if opened (hold your nose) will have gone bad (see the photo to the right).
Nest box hygiene is very important as mucky eggs increase the risk of bacteria getting inside an egg making it far more likely for a hatching egg to go bad, or if the egg is for eating for us to pick up illnesses such as Salmonella. Hens should not be allowed to sleep in nest boxes at night, otherwise they will soil them. This can be discouraged by making perches higher than nest boxes and blocking them off in the late afternoon before they go to roost.