Skip to content

How-ToOS

How to Add an Exclusion to Microsoft Defender in Windows 11 (Safely)

Microsoft Defender keeps flagging a file you trust? Rather than switching protection off, you can exclude a file, folder, file type or process in Windows Security. Following Microsoft's guidance, we show how to add and remove exclusions, use wildcards safely and what exclusions don't cover.

By , Systems & Technical Editor

4 min read

How to Add an Exclusion to Microsoft Defender in Windows 11 (Safely)

Microsoft Defender Antivirus scans files and processes in the background as you open or download them. Occasionally that gets in the way: a trusted tool you rely on keeps being flagged, or a folder of work files you know are safe is constantly being checked. Rather than switching Defender off, Windows Security lets you add an exclusion for a specific file, folder, file type or process. This guide follows Microsoft's Windows Security support documentation, checked on 30 November 2026.

Before you start: understand the risk

Microsoft is blunt about this. Adding an exclusion means Microsoft Defender Antivirus "will no longer check those types of files for threats, which could leave your device and data vulnerable". Only exclude something you're certain is safe, ideally software you downloaded from the developer's official site, and keep exclusions as narrow as possible: a single file is safer than a folder, and a folder is safer than a whole file type.

Microsoft also notes that an exclusion is safer than turning real-time protection off altogether. If you do turn real-time protection off, files you open or download won't be scanned while it's off, although Microsoft says it turns itself back on automatically after a short while.

If you think Defender has wrongly flagged a file, consider sending it to Microsoft rather than (or before) excluding it: Windows Security's settings include a Submit a sample manually option.

How to add an exclusion

  1. Open the Windows Security app (search for it from the Start menu).

  2. Select Virus & threat protection.

  3. Under Virus & threat protection settings, select Manage settings.

  4. Scroll down to Exclusions and select Add or remove exclusions.

  5. Choose one of the four exclusion types below, then pick the file or folder, or enter the file extension or process name.

The four exclusion types

Type

What Microsoft says it does

When it makes sense

File

Excludes a specific file

A single trusted tool that's repeatedly flagged

Folder

Excludes a specific folder and all of the files within it

A folder of your own project or work files you know are safe

File type

Excludes all files of a specified type, such as .docx or .pdf

Rarely; this is the broadest option

Process

Any file opened by that process is excluded from real-time scanning

Trusted software that opens lots of files

For process exclusions, Microsoft recommends using the full path and file name, because this "makes it less likely that malware could use the same filename as a trusted and excluded process and evade detection".

What an exclusion does and doesn't cover

Microsoft says exclusions only apply to real-time scanning with Microsoft Defender Antivirus. Scheduled scans, or third-party anti-malware products, might still scan those files or processes. For process exclusions specifically, the files that process opens are still scanned by on-demand or scheduled scans, unless you've also created a file or folder exclusion that covers them.

That's useful to know: an excluded file can still turn up in a scheduled scan. For the differences between scan types, see Microsoft Defender Quick Scan vs Full Scan.

Using wildcards and environment variables

Windows Security accepts the asterisk (*) as a wildcard for any number of characters. Microsoft gives these examples:

  • File type: an extension of *st excludes .test, .past, .invest and any other file type whose extension ends in "st". Be careful, because a short wildcard can match far more than you intend.

  • Process: C:\MyProcess\* excludes files opened by all processes located in C:\MyProcess or any of its subfolders, and test.* excludes files opened by all processes named test, regardless of the file extension.

You can also use environment variables in process exclusions. Microsoft's example is %ALLUSERSPROFILE%\CustomLogFiles\test.exe, which excludes any files opened by C:\ProgramData\CustomLogFiles\test.exe.

How to remove an exclusion

Exclusions are easy to forget, so review them now and then. Go back to Virus & threat protection > Manage settings > Add or remove exclusions, select the exclusion you no longer need and select Remove.

Tamper protection and Controlled folder access

Tamper protection, which Microsoft says helps prevent malicious apps from changing important Defender settings, doesn't stop you as an administrator changing settings in the Windows Security app; it stops other apps doing so. Our guide on how to turn on Tamper Protection in Windows 11 explains more.

If an app is being blocked from saving to your Documents or Pictures folders rather than being flagged as malware, the cause is probably Controlled folder access, not a detection. That needs an allowed app, not an exclusion; see how to turn on ransomware protection in Windows 11.

The bottom line

Add a Microsoft Defender exclusion only for something you're certain is safe, and keep it as narrow as you can: a single file or folder rather than a whole file type, and a process by its full path. It's a safer option than switching real-time protection off, but excluded items lose real-time scanning, so review your exclusions occasionally and remove any you no longer need.

Sources

  1. 01Microsoft Support: Virus and threat protection in the Windows Security app

About the author

Marcus Thorne

Systems & Technical Editor

Marcus writes Forge PC's step-by-step build, troubleshooting and system optimisation guides. His background spans Windows kernel and power-state diagnostics, UEFI/BIOS configuration, NVMe storage arrays, ATX 3.1 power delivery and running local AI and LLM workloads on consumer graphics cards.

More from Marcus Thorne

Read next

The Best NVIDIA App Features in 2026: What's Worth Using on a GeForce PC

Best Picks

The Best NVIDIA App Features in 2026: What's Worth Using on a GeForce PC

The NVIDIA App does far more than update drivers. Based on NVIDIA's official pages, we pick the features most worth using on a GeForce PC, from DLSS Override and Smooth Motion to Instant Replay, the performance overlay, RTX HDR and one-click GPU tuning, and explain who each suits.

Hannah Vance4 min

Microsoft Defender Quick Scan vs Full Scan: Which Should You Run?

Versus

Microsoft Defender Quick Scan vs Full Scan: Which Should You Run?

Windows Security offers Quick, Full, Custom and Offline scans, and the longest isn't always best. Using Microsoft's own documentation, we explain what each Microsoft Defender scan checks, how long full scans can take and which to run for everyday checks, USB drives and stubborn malware.

Callum Reid4 min

llamafile vs llama.cpp: Which Is the Better Way to Run Local AI on Your PC?

Versus

llamafile vs llama.cpp: Which Is the Better Way to Run Local AI on Your PC?

llamafile packages llama.cpp, and optionally a model, into one file that runs without installation, while llama.cpp is the upstream engine itself. Using official READMEs and docs, we compare setup, the Windows 4GB limit, model support, GPU backends and which suits you.

Callum Reid3 min

How to Run a llamafile on Windows 11: Local AI in a Single File

How-To

How to Run a llamafile on Windows 11: Local AI in a Single File

llamafile from Mozilla.ai packs a local AI model and the software to run it into one file, with nothing to install. Following the official docs, we show how to run one on Windows 11, get round the 4GB executable limit with separate GGUF models, use your graphics card and start the built-in server.

Marcus Thorne4 min