What to do if your computer has a virus
If your computer is running slowly, showing pop-ups you didn't click, or displaying warnings that look official, you likely have malware or a virus. The fastest way to remove it is to boot your computer into Safe Mode (a stripped-down version that loads only essential programs), then run a malware scanner like Malwarebytes or Windows Defender Offline. These tools can detect and remove infections that regular antivirus software misses because they run before the virus has a chance to block them.
Most viruses can be removed without losing your files or reinstalling Windows. The key is acting before the infection spreads to your system files or your backups. If your computer won't start normally, or if a scanner finds threats it cannot remove, you may need to wipe the drive and reinstall your operating system — but that is a last step, not a first one.
Key Takeaways
- Restart your computer in Safe Mode with Networking, which disables most programs and gives malware less room to hide or defend itself.
- Download Malwarebytes or Windows Defender Offline on a different device, transfer it to an external drive, and run it on the infected computer.
- Let the scan finish completely and remove all threats it finds, even if the computer asks to restart multiple times.
- After removal, change your passwords on a different device, then check your browser homepage and installed programs for anything unfamiliar.
- If a scanner cannot remove the threat or your computer will not start, you may need to reinstall your operating system, but back up your files first if possible.
How to boot into Safe Mode
Safe Mode loads only the drivers and programs your operating system needs to run. Viruses often cannot function in Safe Mode because they rely on other software to hide or spread. On Windows 10 and 11, restart your computer and immediately press F8 or Shift+F8 repeatedly as it boots — you should see a menu with boot options. Select "Safe Mode with Networking" so you can download a scanner if you need one.
On a Mac, restart and hold Command+S while it boots to enter Single User Mode, or hold Shift to enter Safe Boot. The process is different because Macs use a different operating system, but the principle is the same: fewer programs running means the virus has fewer tools to work with.
If your computer will not boot into Safe Mode at all, or if it boots but immediately shows a blue screen or crashes, the infection may have damaged system files. In that case, skip to the section on reinstalling your operating system.
Running a malware scanner from outside Windows
If your antivirus software is not catching the threat, you need a scanner that runs before Windows fully loads. The two most reliable options are Malwarebytes and Windows Defender Offline. Both are free and both can remove infections that regular antivirus software cannot.
To use either one, you will need a second device (a phone, tablet, or another computer). Go to malwarebytes.com or microsoft.com/en-us/windows/business/windows-defender on the clean device, download the tool, and save it to an external USB drive. Then plug the drive into the infected computer, boot into Safe Mode, and run the scanner from the drive. Let it scan your entire hard drive — this can take 30 minutes to several hours depending on the size of your drive and how many files the virus has infected.
Do not interrupt the scan or restart the computer while it is running. When the scan finishes, the tool will show you a list of threats. Click "Remove" or "Quarantine" to delete them. The computer may restart several times during this process — that is normal.
What to do after the virus is removed
Once the scanner reports that all threats have been removed, your computer is not fully clean yet. Viruses often steal passwords and install other malware that a scanner might miss. Change your passwords for email, banking, and any other sensitive accounts — but do this on a different device first, in case your computer is still compromised. Use a phone or a different computer to log into your email and banking sites and change your passwords there.
Then check your infected computer for signs of other problems. Look at your browser homepage — if it has changed to something unfamiliar, reset it back to what you want. Check your installed programs list (Settings > Apps on Windows, or Applications folder on Mac) and uninstall anything you do not recognize. Look at your browser extensions and remove any you did not install yourself.
Finally, run your regular antivirus software (Windows Defender, Norton, McAfee, or whatever you use) and let it do a full scan. This catches anything the malware scanner missed and gives you a baseline for future scans.
When you need to reinstall your operating system
If the malware scanner cannot remove the threat, or if your computer will not boot into Safe Mode, or if it keeps crashing after you remove the virus, the infection has likely damaged system files. At that point, reinstalling Windows or macOS is often faster than trying to repair the damage.
Before you reinstall, back up your files if you can. If the computer will not start at all, you may need to remove the hard drive and connect it to another computer using a USB adapter, then copy your files to an external drive. If the computer starts but is unstable, copy your important files (documents, photos, downloads) to an external drive while you still can.
To reinstall Windows, go to microsoft.com/en-us/software-download/windows11 (or Windows 10 if that is what you have) on a different device, download the installation tool, and follow the prompts to create a bootable USB drive. Plug that drive into the infected computer, restart, and boot from the USB drive. The installer will guide you through wiping the drive and reinstalling Windows from scratch. This removes the virus completely but also removes all your programs — you will need to reinstall them afterward.
How to avoid getting a virus in the first place
Most viruses arrive through email attachments, fake download sites, or compromised websites. Keep your operating system and browser updated — Microsoft and Apple release security patches regularly, and running old software is the easiest way to get infected. Turn on automatic updates in Settings so you do not have to remember.
Be cautious with email attachments, especially from people you do not know. Do not open a .exe, .zip, or .msi file unless you are certain what it is. If someone sends you a file you were not expecting, ask them about it before opening it. Download software only from the official website or from a trusted app store — do not use search results that say "Download Now" in large letters, because those are often ads for malware.
Run antivirus software and keep it updated. Windows Defender (built into Windows) is free and adequate for most people. If you want more protection, Malwarebytes Premium runs in the background and blocks threats before they land on your computer. Neither is perfect, but both are better than nothing.
Frequently Asked Questions
Can I remove a virus without restarting my computer?
Not reliably. A virus that is currently running can block or interfere with removal tools. Restarting into Safe Mode gives the scanner a chance to work without the virus fighting back. If you are worried about losing work, save your files first, then restart.
Will removing a virus delete my files?
A malware scanner removes the virus, not your files. Your documents, photos, and downloads stay on your computer. However, some viruses do delete or encrypt your files as part of their attack — if that has happened, removal will not bring them back. That is why backups matter.
What if the virus comes back after I remove it?
If the same threat keeps reappearing, either the scanner did not remove it completely, or you are reinfecting yourself by opening the same malicious file or visiting the same compromised website. Check your Downloads folder for any suspicious files and delete them. If it keeps happening, reinstalling your operating system is the safest option.
Do I need to pay for a malware scanner?
No. Malwarebytes, Windows Defender Offline, and Kaspersky Rescue Disk are all free and all work well. Paid versions add features like real-time protection, but for a one-time removal, the free versions are sufficient.
Is it safe to use my computer while the malware scanner is running?
No. Close all other programs and let the scan finish. Using your computer while the scan runs can interfere with detection and removal, and it slows down the scan significantly.