An apparatus for sterilizing containers includes a transport device which transports the containers along a predefined transport path (P), a radiation device which applies radiation (S) to at least some sections of the containers and/or components of the apparatus for sterilization purposes, and a sensor device which detects radiation occurring as a result of the radiation (S) emitted by the radiation device. The apparatus has a shielding element which attenuates the radiation reaching the sensor device in a working mode of the apparatus, and a movement device for moving said shielding element relative to the sensor device.