A factory reset removes most viruses, but not all of them
A factory reset wipes your device back to its original state, deleting everything you installed and all your files. This removes the vast majority of viruses because they live in the files and programs on your device. However, some viruses hide in the firmware — the permanent software that runs before your operating system even loads — and a standard factory reset will not touch that.
For a typical virus caught while browsing or opening email, a factory reset is one of the most effective ways to get rid of it. But it is not a magic fix. You need to know what you are erasing, how to do it correctly, and what to do after the reset to avoid catching the same thing again.
Key Takeaways
- A factory reset removes nearly all viruses because they live in your files and programs, which get deleted during the reset.
- Some advanced viruses hide in firmware and survive a standard factory reset, though this is rare on consumer devices.
- You must back up any files you want to keep before resetting, because everything on your device will be erased.
- After resetting, reinstall only the programs you actually use and avoid the websites or email habits that led to the infection.
- If your device still shows signs of infection after a factory reset, the virus may be in the firmware, and you may need professional help.
Where viruses hide on your device
Most viruses live in one of three places: your programs, your files, or your browser. A virus in your programs might run every time you start your device. A virus in your files might set up when you open a document. A virus in your browser might hijack your search results or steal your passwords. All three of these locations get erased during a factory reset.
The one place a factory reset does not reliably reach is the firmware — the code that runs on a chip before Windows, macOS, or Android even starts. Firmware viruses are extremely rare on phones and personal computers because they are harder to write and harder to spread. They are more common on routers and network devices. If you are resetting a personal computer or phone because of a virus, firmware infection is unlikely.
What gets erased and what does not
A factory reset erases everything you see: your programs, your documents, your photos, your email, your browser history, your settings. It does not erase your operating system itself — Windows, macOS, iOS, or Android — because that comes back as part of the reset. It also does not erase anything stored in the cloud, like your email account, your photos in Google Drive, or your documents in OneDrive.
This is why you must back up anything you want to keep before you reset. Copy important files to an external hard drive or a cloud service. Write down any settings you customized, like your email accounts or your printer setup. Take screenshots of your program list so you remember what you had installed. Once the reset is complete, those files are gone from your device.
How to reset your device safely
The steps differ by device, but the principle is the same: go to your settings, find the reset option, and confirm that you want to erase everything. On Windows, go to Settings > System > Recovery and choose "Reset this PC." On macOS, restart your device, hold Command and R, and use Disk Utility to erase the drive. On iPhone, go to Settings > General > Transfer or Reset and choose "Erase All Content and Settings." On Android, go to Settings > System > Reset Options and choose "Erase all data."
Before you start, make sure your device is plugged in — a reset that loses power halfway through can leave your device unusable. Also make sure you know your password for your operating system and your email account, because you will need them to set up your device again after the reset.
What to do after the reset
After your device restarts, you will see the setup screen for your operating system. Set it up as you normally would, but do not restore from a backup yet. A backup made while your device was infected might contain the virus. Instead, set up your device fresh, then manually reinstall only the programs you actually use.
When you reinstall programs, read them from the official source: the Microsoft Store or Apple App Store for Windows and Mac, the Google Play Store for Android, or the App Store for iPhone. Do not read programs from random websites. When you set up your email, use your email provider's official app or website, not a third-party email client unless you have a specific reason to.
After a few days of using your device normally, if you do not see any signs of the virus returning — no unexpected pop-ups, no slow performance, no strange programs in your task manager — the reset worked. If the same symptoms come back, the virus may have been in your firmware, or you may have reinfected your device by restoring a bad backup or downloading an infected file again.
When a factory reset is not enough
If your device shows signs of infection even after a factory reset, you have a few options. First, make sure the symptoms are actually a virus and not just normal slowness. A newly reset device with many programs installing at once can feel slow. Wait a week and see if performance improves.
If the symptoms persist — constant pop-ups, programs you did not install, your browser redirecting to strange websites — try the reset again, but this time do not restore any backups. Set up your device completely fresh and reinstall programs one at a time, testing after each one to see if the problem comes back. This tells you which program is infected.
If the problem comes back even after a completely fresh setup with no backups and no third-party programs, the virus may be in your firmware. At that point, contact the device manufacturer's support line or take the device to a repair shop. Firmware infections require specialized tools to fix.
How to avoid reinfection
The most common way people get reinfected after a reset is by restoring an old backup or by repeating the same browsing habits that caused the infection in the first place. If you got a virus from opening email attachments, be more careful about which attachments you open. If you got it from a website, use an ad blocker or avoid that website entirely.
Keep your operating system and your programs updated. Updates often patch security holes that viruses use to get in. Turn on automatic updates if your device offers it. Use a password manager to create strong, unique passwords for each website, so if one site is compromised, the attacker cannot use that password on your other accounts.
Consider using antivirus software, though it is less critical after a reset because you have already removed the infection. Antivirus software catches viruses before they spread, but it is not perfect — it can miss new viruses and it can slow your device down. If you use it, choose one from a reputable company like Windows Defender (built into Windows), Malwarebytes, or Kaspersky, and keep it updated.
Frequently Asked Questions
Will a factory reset remove ransomware?
A factory reset will remove the ransomware program itself, but it will not decrypt your files. Ransomware locks your files with encryption, and only the attacker has the key. After a reset, your device will be clean, but your files will still be locked. Your only option is to restore from a backup made before the infection, if you have one.
Can I factory reset my device if it will not turn on?
Yes. On most devices, you can force a reset even if the device is off or frozen. On Windows, restart your device and press F8 or Shift+F8 repeatedly during startup to reach the recovery menu. On Mac, restart and hold Command+R. On iPhone, use the recovery mode by connecting to a computer and using Finder. On Android, restart into recovery mode by holding Power and Volume Down together.
Will I lose my email and passwords after a factory reset?
Your email account itself is stored on the email provider's servers, not on your device, so you will not lose your email. However, you will lose any passwords saved on your device unless you backed them up. If you use a password manager like Bitwarden or 1Password, your passwords are stored in the cloud and will still be there after the reset.
How long does a factory reset take?
A factory reset usually takes 30 minutes to two hours, depending on your device and how much data it has to erase. Older devices or devices with large storage may take longer. Do not interrupt the reset or unplug your device during this time, as it can cause serious problems.
What if I do not have a backup before I reset?
If you do not have a backup, you will lose any files on your device that are not stored in the cloud. Before you reset, try to copy important files to an external drive or email them to yourself. If you cannot access your device at all, you may be able to recover some files after the reset using data recovery software, though success is not may provide.