How To Turn Off Data Execution Prevention In Windows (2026)
Data Execution Prevention, or DEP, is a Windows memory protection that you can turn off for one program or for the whole PC.
Microsoft documents both methods, and the one-program method is far safer than the system-wide one.
This guide shows each method with the exact settings, plus the command that turns DEP back on.
Table of Contents
- Quick answer
- What DEP does
- Why people turn it off
- Before you start
- Turn off DEP for one program in Windows Security
- Program name or exact path
- Turn off DEP for one program with PowerShell
- Turn off DEP for the whole PC
- What each nx value means
- Turn DEP back on
- If turning DEP off does not help
- Official sources
- More Windows guides
Quick answer
| Goal | Method | Risk |
|---|---|---|
| Stop DEP for one program | Windows Security > Exploit protection > Program settings | Lower, limited to that program |
| Stop DEP for one program by command | Set-ProcessMitigation in PowerShell | Lower, limited to that program |
| Turn DEP off for everything | bcdedit /set nx AlwaysOff, then restart | Highest, affects the whole PC |
| Put it back | bcdedit /set nx OptIn, then restart | Restores the default |
What DEP does
Microsoft describes DEP as a set of hardware and software technologies that check memory to help protect against malicious code.
Hardware-enforced DEP marks all memory locations in a process as non-executable unless they explicitly contain executable code.
When code tries to run from non-executable memory, DEP intercepts the attempt and raises an exception.
Microsoft’s developer page says that if the exception is not handled, the calling process is terminated.
Why people turn it off
The usual reason is an older program that closes or shows an error as soon as DEP stops it.
Microsoft’s developer documentation says dynamic code generation, such as JIT, can break on a DEP-enabled system if the generated code is not marked as executable.
It also says ATL 7.1 and earlier can run code on non-executable pages, which triggers a fault that ends the application.
Microsoft’s page says DEP is not meant to be a complete defence, but it is one more layer you give up when you switch it off.
Before you start
- Sign in with an administrator account, because the commands need administrator rights.
- Try the one-program method first, since it leaves DEP on for everything else.
- Only change the program you trust, because turning DEP off removes a protection against attacks on that program.
Microsoft says DEP can be configured only for 32-bit (x86) apps in exploit protection, and it is permanently enabled for other architectures.
Turn off DEP for one program in Windows Security
- Open Windows Security from the taskbar shield icon or the Start menu.
- Select App & browser control, then select Exploit protection.
- Under Program settings, select Add program to customize, or select the program if it is already listed and choose Edit.
- Choose Add by program name (include the .exe extension) or Choose exact file path.
- Find Data Execution Prevention (DEP), tick Override system settings and set the switch to Off.
- Select Apply.
Microsoft says Windows may ask you to restart the process, the app or the device, and a User Account Control prompt may need administrator credentials.
Program settings take precedence over System settings when both define the same mitigation.
Program name or exact path
| Option | What it does |
|---|---|
| Add by program name | Applies to any running process with that name, and you must include the file extension |
| Enter a full path with the name | Limits the setting to that location |
| Choose exact file path | Opens a standard file picker so you pick the program |
| Audit | Applies a mitigation in audit mode only |
Turn off DEP for one program with PowerShell
Microsoft’s exploit protection page shows Set-ProcessMitigation for DEP and these commands come from it, with Disable swapped in for Enable.
Open Windows Terminal (Admin) and run the command with your program’s name.
Set-ProcessMitigation -Name program.exe -Disable DEP
To check what is set for that program, run the command below.
Get-ProcessMitigation -Name program.exe
To remove your override so the program follows the system default again, Microsoft shows this form.
Set-ProcessMitigation -Name program.exe -Remove -Disable DEP
Turn off DEP for the whole PC
Only use this if a single-program override did not fix the problem, and be ready to undo it.
- Select Start, type cmd, then select Run as administrator for Command Prompt.
- Type
bcdedit /set nx AlwaysOffand press Enter. - Restart the PC, because Microsoft says any change to a boot option requires a restart.
Microsoft’s BCDEdit page warns that changing some boot entry options could render your computer inoperable.
It also says you might need to disable or suspend BitLocker and Secure Boot before setting BCDEdit options.
What each nx value means
| Value | Microsoft’s description |
|---|---|
| OptIn | DEP only for operating system components, including the Windows kernel and drivers |
| OptOut | DEP for the operating system and all processes, and administrators can exclude selected programs |
| AlwaysOn | DEP for the operating system and all processes, and all attempts to disable it are ignored |
| AlwaysOff | DEP is disabled, and attempts to enable it selectively are ignored |
Microsoft’s DEP support-policy table lists OptIn as the default.
Turn DEP back on
- Open Command Prompt as administrator.
- Type
bcdedit /set nx OptInand press Enter. - Restart the PC.
The BCDEdit page also says bcdedit /deletevalue nx removes a value you set.
To undo a single-program override, use the Remove command shown above, or switch the override off in Exploit protection.
If turning DEP off does not help
| Situation | What to know |
|---|---|
| The program is 64-bit | Exploit protection can only configure DEP for 32-bit apps |
| A work or school policy applies | Group Policy changes override local exploit protection settings |
| The change did not apply | Restart the process, the app or the PC as Windows asks |
| Hardware DEP will not change | Microsoft says some systems let you disable it in the BIOS under a name such as NX or XD |
If the PC no longer starts after a boot change, see our guide to fixing missing or corrupted boot configuration data.
To check for unwanted software before you lower any protection, run a Windows Security offline scan.
If a firewall rather than DEP is blocking a program, see how to block a program from the internet for the matching rule steps.
Official sources
- Microsoft Learn: Customize exploit protection
- Microsoft Learn: BCDEdit /set
- Microsoft Learn: Data Execution Prevention
- Microsoft Learn: Determine hardware DEP is available
More Windows guides
- How To Convert MBR To GPT In Windows 11 Without Data Loss (2026)
- How To Turn Off Windows 11 Telemetry And Diagnostic Data (2026)
- How To Uninstall ESET From Windows Step By Step (2026)
- How To Uninstall Kaspersky Completely From Windows (2026)
- Local Security Authority Protection Is Off In Windows 11 (2026)
- How To Use Ping And Tracert In Windows 11 (2026)
See all: Windows 11 Guides