Nonsteroidal anti-inflammatory drugs (NSAIDs) alleviate pain by counteracting the cyclooxygenase (COX) enzyme. On its own, COX enzyme synthesizes prostaglandins, creating inflammation. In whole, the NSAIDs prevent the prostaglandins from ever being synthesized, reducing or eliminating the pain.