New indomethacin analogs 4a–g, 5, 6, 8a, and 8b were synthesized to overcome the nonselectivity and ulcer liability of indomethacin. All newly synthesized compounds were more potent against cyclooxygenase 2 (COX‐2; IC50 value range: 0.09–0.4 μМ) as compared with celecoxib (IC50 = 0.89 μМ). Compounds 4a, 4b, 4d, 5, and 6 showed the highest COX‐2 selectivity index (SI range = 4.07–6.33) as compared with indomethacin (SI = 1.14) and celecoxib (SI = 3.52). Additionally, 4a, 4b, 4d, 5, and 7 showed good anti‐inflammatory activity with edema inhibition (79.36–88.8%), relative to celecoxib (78.96%) and indomethacin (90.43%), after 5 h. Also, ulcerogenic effects and histopathological examination were assessed for the most potent analogs, 4b, 4d, 5, and 6, to determine their safety. The results can shed light on indomethacin analog 5 as a remarkable anti‐inflammatory lead compound with a good safety profile (ulcer index = 10.62) close to the nonulcerogenic drug celecoxib (ulcer index = 10.53) and better than indomethacin (ulcer index = 18.50). Docking studies were performed in the COX‐2 active site for the most active compounds, to test their selectivity and to confirm their mechanism of action.