In most cases, a factory reset can remove malware from your device. It should be used as the last line of defense if you want to protect any files located on the device.