Nonsteroidal anti-inflammatory drugs (NSAIDs) work by inhibiting cyclooxygenase (COX) enzymes and subsequent prostaglandin production. This reduces pain, fever, and inflammation. NSAIDs inhibit both COX-1 and COX-2, with COX-1 inhibition causing side effects like gastric ulceration, while selective COX-2 inhibitors have fewer side effects but higher costs. The mechanisms of analgesia, antipyresis, and anti-inflammation by NSAIDs are through inhibition of prostaglandin biosynthesis in both the central and peripheral nervous systems.