Menstrual cramps are most likely caused by an excess of prostaglandins—hormone-like compounds that are released from the uterine lining (the endometrium) as it prepares to be shed. Prostaglandins help the uterus contract and relax, so that the endometrium can detach and flow out of your body. They are a necessary part of the process, but in excess, they cause pain if the uterus contracts strongly, blood flow is reduced, and the supply of oxygen to the uterus muscle tissue decreases, causing pain.
For most people with period cramps, it’s still unknown what predisposes them, and not others, to painful menstruation. Inflammation may play a role. The production of prostaglandins is related to inflammation, and inflamed tissue tends to produce more prostaglandins. People who experience more menstrual pain have also been shown to have higher levels of inflammatory markers in the blood, even after adjustment for factors related to chronic inflammation, like BMI, smoking, and alcohol consumption. Inflammation has also been linked to the worsening of other premenstrual symptoms, including mood changes.
People are more likely to have painful periods if they have heavy or long period bleeding, if they started menstruating early in life, or if their periods are irregular. Other factors that have been associated with painful periods include smoking, being thin, being younger than 30, having a pelvic infection, and being sterilized.