Novel dihydropyrazole 5-8, 10 and pyrazole derivatives 12, 14, 15, 17 were synthesized. The structures of the newly synthesized compounds were elucidated by spectral and elemental analyses. The anti-inflammatory activity of all new compounds was evaluated using the carrageenan-induced rat paw edema test using indomethacin and celecoxib as reference drugs. The most active derivatives as anti-inflammatory agents were accordingly tested for their analgesic activity using the p-benzoquinone-induced writhing method in mice and results revealed that these compounds had also good analgesic activity. The ulcerogenic liability of the selected compounds was also evaluated. Results showed that the selected derivatives had anti-inflammatory activity comparable to or slightly lower than the reference drugs, reaching about 82% inhibition with a considerable gastric safety profile.