Factory reset wipes your device clean, but it is not a reliable way to remove viruses

A factory reset erases everything on your device and reinstalls the original operating system — which sounds like it should kill any virus. In practice, it often does. But it is not a may provide, and it comes with real costs: you lose all your files, photos, and settings, and some sophisticated malware can survive the process or hide in parts of your device that a standard reset does not touch.

If you suspect a virus, a factory reset should be your last option, not your first. It makes sense only after you have tried removing the malware directly, backed up the files you need, and confirmed that nothing else will work. For most people, running a dedicated antivirus scan or taking the device to a technician is faster and safer.

Key Takeaways

  • A factory reset removes most common viruses because it deletes the files where malware lives, but it is not foolproof — some advanced malware can survive or hide in firmware.
  • You will lose all your files, photos, messages, and settings when you factory reset, so back up anything you need before you start.
  • Before you reset, try running a full antivirus scan with a program like Malwarebytes or Windows Defender, which can remove many viruses without erasing your data.
  • If your device is still under warranty or you are not confident doing a reset yourself, a repair shop can diagnose the problem and may be able to remove the malware without a full wipe.
  • After a factory reset, reinstall only the software you actually use and turn on automatic updates to prevent the same infection from happening again.

What a factory reset actually removes

A factory reset deletes every file on your device's main storage — documents, photos, installed programs, browser history, saved passwords, everything. It then reinstalls a clean copy of the operating system (Windows, macOS, Android, or iOS) as it came from the manufacturer. Because most viruses live in files on your storage drive, they get deleted in the process.

This works well for common viruses and spyware that sit in your Downloads folder, hide in program files, or embed themselves in documents. Once those files are gone, the malware is gone. Your device boots up fresh, and you start over.

The catch is that not all malware lives in the places a factory reset touches. Some viruses hide in the firmware — the low-level code that runs before the operating system even loads. Some hide in the recovery partition, a hidden section of your drive that stores backup files. And some sophisticated malware can reinstall itself from the cloud or from a compromised account if you sign back in with the same username and password.

When a factory reset is not enough

If your device is infected with rootkit malware — code that runs at the deepest level of the system — a standard factory reset may not remove it. Rootkits can survive a reset because they load before the operating system does, and they can prevent the reset from working properly in the first place. Removing a rootkit usually requires professional tools or, in severe cases, replacing the device entirely.

If your infection came through a compromised email account or cloud service, resetting the device will not help if you sign back in with the same account. The malware can reinfect you when ready. In this case, you need to change your password first, check your account recovery options, and make sure no one else has access to it.

Ransomware — malware that encrypts your files and demands payment — cannot be removed by a factory reset, because the encryption happens on your files, not in the operating system. A reset will delete the ransomware program itself, but your files stay encrypted. Your only option is to restore from a backup made before the infection.

Steps to take before you factory reset

Before you erase everything, try removing the malware without losing your data. read Malwarebytes (free version available) or use the antivirus that came with your device — Windows Defender on Windows, or the built-in security tools on Mac. Restart your device in Safe Mode (a stripped-down version that loads only essential programs), then run a full system scan. Many viruses cannot run in Safe Mode, so the antivirus can find and delete them.

If the scan finds malware and removes it, restart normally and run the scan again. If it finds nothing the second time, the infection is likely gone. This takes an hour or two but saves you from losing all your files.

If the scan finds malware but cannot remove it, or if your device is so slow or broken that you cannot run a scan, then a factory reset becomes necessary. Before you do it, back up any files you need. Connect an external hard drive or use cloud storage (Google Drive, OneDrive, iCloud) to copy documents, photos, and anything else you cannot afford to lose. Do not back up executable files (.exe, .app, .apk) or anything you are not sure about — you might back up the malware itself.

How to factory reset your device

The steps vary by device, but the general process is the same: go to Settings, find the Reset or Erase option, and confirm that you want to erase everything. On Windows, go to Settings > System > Recovery > Reset This PC. On Mac, restart while holding Command + R to enter Recovery Mode, then choose Erase Mac. On Android, go to Settings > System > Reset Options > Erase All Data. On iPhone, go to Settings > General > Transfer or Reset > Erase All Content and Settings.

The reset usually takes 30 minutes to an hour. Your device will restart several times. Do not turn it off or unplug it during the process — interrupting a reset can leave your device unbootable. Once it finishes, you will see the setup screen, as if the device is brand new.

If you are not comfortable doing this yourself, or if your device will not start up at all, take it to a repair shop. Technicians have tools to diagnose whether the problem is actually a virus, and they can often remove malware without a full reset. This costs money, but it is worth it if you have files you cannot afford to lose or if you are unsure of the process.

What to do after the factory reset

After your device restarts, do not when ready restore all your old files. Set up the device fresh: create a new user account, sign in with your email, and reinstall only the software you actually use. Avoid installing pirated software, cracked programs, or anything from untrusted websites — that is how most people get infected in the first place.

Turn on automatic updates for your operating system and for any programs you install. Updates patch security holes that malware exploits. On Windows, go to Settings > Update & Security and make sure Windows Update is on. On Mac, go to System Preferences > Software Update. On Android and iPhone, updates happen automatically if you have enough storage space.

Consider installing antivirus software and keeping it running. Windows Defender (built into Windows) and Malwarebytes (free or paid) are both solid choices. On Mac, the built-in security is usually enough, but Malwarebytes adds an extra layer. On Android and iPhone, the built-in security is generally sufficient if you only install apps from the official app stores.

If you had files backed up before the reset, restore them gradually and scan them with antivirus software first. If you backed up to cloud storage, read them one folder at a time and check that your device is still running smoothly. If restoring a particular folder causes problems to come back, that folder likely contained the malware.

Alternatives to factory reset

If you want to avoid losing your files, or if you are not sure whether you actually have a virus, start with a professional diagnosis. Many repair shops offer free or low-cost scans. They can tell you whether the slowness or strange behavior is actually malware or something else — a full hard drive, a failing battery, or outdated software.

If you do have malware but it is not severe, a technician can often remove it using specialized tools like Kaspersky Rescue Disk (for Windows) or similar programs that run outside the normal operating system. These tools can find and delete malware that regular antivirus software misses, and they do not require you to erase your device.

If your device is old, slow, or infected repeatedly, replacing it may be cheaper and faster than trying to fix it. A used device from a reputable seller costs less than a repair, and you start fresh without worrying about hidden malware.

Frequently Asked Questions

Will factory reset remove all viruses?

Most common viruses, yes. But sophisticated malware like rootkits can survive a reset, and ransomware cannot be removed by a reset because it encrypts your files, not the operating system. If you have reason to believe your infection is severe, a repair shop can diagnose it before you reset.

Can I factory reset my phone if it is locked by malware?

Yes, but the process is different. On Android, hold the power button and volume down together until the recovery menu appears, then select Wipe Data. On iPhone, you can reset it through iCloud.com even if the phone is locked. If you cannot access either, take it to an Apple Store or Android repair shop.

What if I factory reset and the problem comes back?

You likely signed back into a compromised account. Change your email password and check your account recovery options (phone number, backup email) to make sure no one else has access. If the problem persists, the infection may be in your firmware, and you need professional help.

Do I need to factory reset if antivirus removed the malware?

Not usually. If antivirus found and removed the malware, and a second scan finds nothing, your device is clean. Factory reset is only necessary if antivirus cannot remove the malware or if your device is too broken to run a scan.

How do I know if I actually have a virus?

Signs include: your device is much slower than usual, programs crash or freeze, you see pop-ups you did not click on, your battery drains fast, or your data usage is unusually high. Run an antivirus scan to confirm. If the scan finds nothing and the problems stop, it was probably not malware.