During the first 12 weeks of pregnancy, the developing foetus is making melanocytes – the skin cells that produce ordinary skin colour. These aren’t always evenly spread out: random areas will acquire a cluster and during your life, these clusters can grow into a mole.
Moles are quite different from freckles. Almost everyone has from 30 to 60 moles on their body, but freckles only occur in people with certain genes – particularly the one responsible for red hair. Freckles also need sunlight to trigger them, while moles appear spontaneously.