To delete a virus on Windows 10 or 11, open Windows Security, select Virus & threat protection, and run a scan: Microsoft Defender finds the malware and removes it. If the virus survives or comes back, run a Microsoft Defender Offline scan, which restarts the PC and scans from outside normal Windows in about 15 minutes.
This guide covers Windows with Microsoft Defender Antivirus, which is built in. If you use another antivirus product, it is in charge and Defender may be switched off, so run that product's scan instead and then come back here for the Offline scan and the cleanup steps.
Step 1: Run a quick scan
- Open Start, type
Windows Securityand open it. - Select Virus & threat protection.
- Select Quick scan.
Microsoft's support page says that when the scan completes, Defender tells you if it found anything. Detections are handled by Defender itself, so you do not have to find or delete files by hand.
Step 2: Run a full scan if the quick scan finds nothing
A quick scan checks the places malware most often lives. If the PC still behaves oddly (unexpected pop-ups, a changed browser home page, programs you did not install), run a deeper scan:
- In Virus & threat protection, select Scan options instead of Quick scan.
- Choose Full scan, then select Scan now.
A full scan takes longer than a quick one, and the PC stays usable while it runs. You can start the same scans from PowerShell with the Start-MpScan cmdlet, whose -ScanType parameter accepts QuickScan, FullScan and CustomScan:
Start-MpScan -ScanType FullScan
To scan a single folder or file, such as a download you do not trust, use -ScanPath. The path below is an example:
Start-MpScan -ScanType CustomScan -ScanPath "C:\Users\alex\Downloads"
Step 3: Use Microsoft Defender Offline for stubborn malware
Some malware, such as rootkits and viruses that overwrite the master boot record, can hide from a scan that runs inside Windows. Microsoft describes the Offline scan as one that boots "from a trusted environment" and runs "from outside the normal Windows kernel". Microsoft's own support page recommends it as the most complete scan.
Save your files and close your programs first. The PC will sign you out and restart.
- Open Windows Security and select Virus & threat protection, then Scan options.
- Select Microsoft Defender Offline scan, then Scan now.
- Save your work when prompted and select Scan. Select Yes on the permission prompt.
- Windows shuts down in less than a minute, runs the scan, and starts normally afterwards.
The equivalent PowerShell command is Start-MpWDOScan, which reboots the device straight away, so save your work before running it.
If the Offline scan does nothing
- Windows Recovery Environment (WinRE) is disabled. Microsoft says that in this case the scan does not run and no error is shown. Check with
reagentc /info, and if the status is Disabled, enable it from an administrator prompt withreagentc /enable. - BitLocker is on for the system drive. Microsoft says to suspend BitLocker protection first, or you may be asked for the BitLocker recovery key when the PC restarts into the offline environment.
- Defender is in passive mode. Offline scan updates require Defender to be the primary antivirus.
- ARM PCs. Microsoft lists ARM versions of Windows 10 and 11 as not supported for the Offline scan.
Step 4: Check what was found
Open Windows Security, select Virus & threat protection, then Protection history. Recent items are listed there, including results from an Offline scan. If a detection is still listed as needing action, open it and follow the options Windows shows.
To confirm that an Offline scan was started, Microsoft documents Event ID 2030 in Event Viewer, under Applications and Services Logs, Microsoft, Windows, Windows Defender, Operational.
Step 5: Clean up after the virus
- Update everything. In Windows Security, open Virus & threat protection updates and select Check for updates, then install pending Windows updates. If updates are stuck, see Windows Update stuck.
- Change important passwords from a different, clean device. If the malware could read what you typed or saved in the browser, the old passwords may be known. Start with email, banking and your Microsoft account.
- Remove programs and browser extensions you do not recognise in Settings, Apps, Installed apps and in your browser's extensions page.
- Scan backups before restoring from them. A backup made while the PC was infected can carry the malware back.
If the file that caused the infection arrived by email or a link, how to spot phishing lists the checks that catch it next time. Types of malware explains what each kind does, which helps you judge how worried to be.
If the PC is locked or your files are encrypted
A message demanding payment to restore your files is ransomware, not an ordinary virus, and a scan will not decrypt your files. Do not pay before reading what ransomware is and what recovery options exist. Disconnect the PC from the network, and keep a copy of the ransom note for reference.
If the virus keeps coming back
Run the Offline scan once more, then check which programs start with Windows: open Task Manager (Ctrl+Shift+Esc), go to the Startup apps page, and look for entries you do not recognise. Disable those, and do not delete them until you know what they are. If scans keep finding the same threat, reinstalling Windows is the remaining option. Back up your personal files first, and scan them before you copy them back.
On a work or school PC, stop and contact your IT team before changing anything. They may need the infected machine as it is.
Frequently asked questions
- Can I delete a virus manually by deleting the file?
- Usually not reliably. Malware often runs from several locations, restarts itself, or is locked while in use, so deleting one file you found can leave the rest in place. Let an antivirus scanner such as Microsoft Defender find and remove all the pieces, and use the Microsoft Defender Offline scan if the malware keeps coming back.
- How long does a Microsoft Defender Offline scan take?
- Microsoft's documentation says the scan takes about 15 minutes. Windows restarts into a separate environment to run it, then restarts again into normal Windows when the scan is complete. Save your work and close programs first.
- Where can I see what Defender found and removed?
- Open Windows Security, select Virus & threat protection, then select Protection history. Recent detections are listed there. After a Microsoft Defender Offline scan, the results appear in the same place.
- Does a factory reset remove a virus?
- Reinstalling or resetting Windows replaces the operating system files, which removes most malware, but it also erases your installed programs and settings, and any infected files you restore from a backup can bring the problem back. Treat it as a last resort after scans fail, and scan your backup before restoring from it.