The invention discloses an electric riveting machine for a bearing retainer and relates to the technical field of machining. The problems are solved that rivets of an existing bearing retainer after riveting are poor in consistency, the sizes of the rivet heads are different, and riveting is not in place. The electric riveting machine comprises a rack, a controller, a bearing fixing base, a riveting punch, an air cylinder, a servo motor, a base, a heater and a horizontal movement mechanism. The air cylinder is vertically arranged at the upper end of the rack, the riveting punch is arranged atthe tail end of a piston rod of the air cylinder, and the heater is arranged on the riveting punch; the base is horizontally arranged in the middle of the rack and moves on the rack in the horizontaldirection through the horizontal movement mechanism, the bearing fixing base is arranged on the upper end face of the base, and the bearing fixing base is arranged at the lower end of the riveting punch; the middle of the bearing fixing base is vertically and fixedly connected with an output shaft of the servo motor, and the air cylinder, the servo motor and the heater is connected with the controller separately. The electric riveting machine is used for bearing processing.