Steroid-induced osteonecrosis of the femoral head (ONFH) is a serious complication caused by long-term or excessive use of glucocorticoids. The present study aimed to ascertain the effects of tripartite motif-containing protein 21 (TRIM21) on the process of steroid-induced ONFH and its hidden action mechanism. TRIM21 expression in dexamethasone (Dex)-treated mouse MC3T3-E1 preosteoblast cells was examined using reverse transcription-quantitative PCR and western blotting. The Cell Counting Kit-8 (CCK-8) method and lactate dehydrogenase release assay were used to respectively measure cell viability and injury. Flow cytometry analysis was used to assay cell apoptosis. Caspase 3 activity was evaluated using a specific assay, while alkaline phosphatase and Alizarin red S staining were used to evaluate osteogenesis. 2,7-dichloro-dihydrofluorescein diacetate fluorescence probe was used to estimate reactive oxygen species generation. Specific assay kits were used to appraise oxidative stress levels. In addition, the expression of apoptosis-, osteogenic differentiation- and Kelch-like ECH-associated protein 1 (Keap1)/nuclear factor erythroid 2-related factor 2 (Nrf2) signaling-associated proteins was assessed using western blotting. In Nrf2 inhibitor (ML385)-pretreated MC3T3-E1 cells exposed to Dex, cell apoptosis, osteogenesis and oxidative stress were detected again as aforementioned. Results revealed that TRIM21 expression was raised in Dex-induced MC3T3-E1 cells and TRIM21 deletion improved the viability and osteogenic differentiation, whereas it hampered the oxidative stress and apoptosis in MC3T3-E1 cells with Dex induction. In addition, silencing of TRIM21 activated Keap1/Nrf2 signaling. Moreover, ML385 partially abrogated the effects of TRIM21 depletion on the oxidative stress, apoptosis and osteogenic differentiation in MC3T3-E1 cells exposed to Dex. In conclusion, TRIM21 silencing might activate Keap1/Nrf2 signaling to protect against steroid-induced ONFH.