The same pigment, or melanin, which determines your skin color causes freckles, but in a slightly different way.
When you are out in the sun for a long time, your skin makes more melanin than when you are indoors.
Sometimes your skin may turn an even brown.
But other times, if the melanin is grouped together in small areas, dark spots, called freckles, appear.
This grouping of melanin is a characteristic that can be inherited from your parents, so it’s quite possible that if they have freckles, you will too.