Abstract Background Anterior femoral notching (AFN) is a severe complication of total knee replacement (TKR), which in a percentage of patients may lead to fractures after surgery. The purpose of this study was to investigate the stress distribution in patients with AFN and the safety depth of AFN during the gait cycle. Methods We performed a finite element (FE) analysis to analyse the mechanics around the femur during the gait cycle in patients with AFN. An adult volunteer was selected as the basis of the model. The TKR models were established in the 3D reconstruction software to simulate the AFN model during the TKR process, and the 1 mm, 2 mm, 3 mm, 4 mm, and 5 mm AFN models were established, after which the prosthesis was assembled. Three key points of the gait cycle (0°, 22°, and 48°) were selected for the analysis. Results The stress on each osteotomy surface was stable in the 0° phase. In the 22° phase, the maximum equivalent stress at 3 mm was observed. In the 48° phase, with the increase in notch depth, each osteotomy surface showed an overall increasing trend, the stress range was more extended, and the stress was more concentrated. Moreover, the maximum equivalent force value (158.3 MPa) exceeded the yield strength (115.1 MPa) of the femur when the depth of the notch was ≥ 3 mm. Conclusions During the gait cycle, if there is an anterior femoral cortical notch ≥ 3 mm, the stress will be significantly increased, especially at 22° and 48°. The maximum equivalent stress exceeded the femoral yield strength and may increase the risk of periprosthetic fractures.