Restarting your phone will not remove malware from your device, but restoring it to factory settings probably will. Before formatting your device, back up your data to restore it in the future. When restoring your phone from a backup, clean the files from malware, viruses, and other harmful software. Use a malware removal tool to clean up and clear your phone's cache, cookies, and browsing history.