How to Set Processor Affinity in Windows 11

To set processor affinity in Windows 11, open Task Manager, go to the Details page, right-click the program’s process, pick Set affinity, clear the CPUs it shouldn’t use and click OK. The change lasts until the program closes; to apply it every time, launch the program with start /affinity.

A video encode is pinning every core while you try to keep a game or a call smooth, and you want that one app limited to a few cores.

What Processor Affinity Does

Processor affinity is the list of logical processors (CPU cores and threads, as Windows counts them) that a process is allowed to run on. By default, a program may use all of them, and Windows decides moment to moment where each piece of work runs. When you set affinity, you fence a process into a smaller group of processors and leave the rest free for everything else.

That is useful in a few specific cases: keeping a long render, encode or compile job from crowding out the app you’re actually using, or working around an older program that behaves badly on many cores. For everyday use, the Windows scheduler usually does a better job than a fixed setting, so treat affinity as a targeted tool rather than a speed boost.

Changing affinity can’t damage your hardware, but it can make the limited program noticeably slower, because it now has fewer processors to work with.

Set Affinity in Task Manager

This is the quickest method, and it works on a program that’s already running. If you need a refresher on getting there, see the different ways to open Task Manager in Windows 11.

  1. Press Ctrl + Shift + Esc to open Task Manager. If it opens in a small window, click More details.
  2. Open the Details page. In the Windows 11 Task Manager, look for Details in the navigation pane on the left (select the menu icon at the top left if you only see icons). The affinity option is on Details, not on the Processes page.
  3. Find the program’s process by its file name, such as encoder.exe. Click the Name column header to sort the list alphabetically, or sort by the CPU column to find the busiest process.
  4. Right-click the process and look for Set affinity in the menu.
Task Manager Details context menu showing Set affinity for an encoder process
Task Manager with a process. Set affinity opens processor selection. (Recreated interface)
  1. In the dialog that opens, you’ll see one check box per logical processor (CPU 0, CPU 1 and so on) and usually an All Processors box at the top. Clear All Processors, then check only the CPUs you want the program to use.
Processor affinity dialog with CPU 0 and CPU 1 checked for an encoder process
Processor affinity dialog. (Recreated interface)
  1. Click OK. The program keeps running, now limited to the processors you picked.

Some programs start several processes with the same name (browsers and many editors do this). Each process has its own affinity, so limiting one of them doesn’t limit the others.

To confirm it worked, open the Performance page, select CPU, then right-click the graph and look for a Change graph to > Logical processors option. The CPUs you cleared should go quiet for that program’s work while the others stay busy. Heavy, sustained load on a few cores can raise temperatures, so if the PC gets loud or hot, you can check your CPU temperature in Windows 11 while the job runs.

To undo it, repeat the steps and check All Processors, or simply close and reopen the program. Affinity set in Task Manager applies only to the running process, so it’s gone the next time the program starts.

Start a Program With Set Affinity From Command Prompt

The Windows start command has a built-in /affinity option. Microsoft’s start command reference describes it as applying a processor affinity mask, written as a hexadecimal number, to the new application. Because you set it at launch, you don’t have to catch the program in Task Manager first.

  1. Press Windows key + R, type cmd and press Enter.
  2. Type a command in this pattern and press Enter: start "" /affinity 3 "C:\Program Files\Encoder\encoder.exe"
  3. Replace the path with the full path to your program, and replace 3 with the mask for the processors you want (see the table below).

The empty pair of quotes is the window title. start treats the first quoted text as the window title, so without the empty pair, a quoted program path becomes the title and you get a new, empty Command Prompt window instead of your program.

How to Work Out the Hex Mask

Affinity mask chart with CPU 0 to CPU 3 bit values and examples for hexadecimal 3 and F
Illustration showing how CPU bit values add up to a hexadecimal affinity mask.

The mask is a row of on/off bits, one per logical processor. According to Microsoft’s ProcessorAffinity documentation, bit 0 is the first processor, bit 1 the second, and so on. Task Manager numbers processors from CPU 0, so bit 0 is CPU 0. Add up the values of the processors you want, then write the total in hexadecimal.

Hex maskProcessors allowed (Task Manager numbering)
1CPU 0 only
3CPU 0 and CPU 1
7CPU 0, 1 and 2
9CPU 0 and CPU 3
FCPU 0 to CPU 3
F0CPU 4 to CPU 7
FFCPU 0 to CPU 7

A worked example: a PC shows 16 logical processors, and you want the encoder kept on the top eight (CPU 8 to CPU 15) so the lower ones stay free for a game. Those eight bits make the hex value FF00, so the command uses /affinity FF00. If you’re unsure, Windows Calculator in Programmer mode converts between binary and hex.

Make the Affinity Stick With a Shortcut

Since Task Manager’s setting disappears when the program closes, a shortcut that runs the start command is the simplest way to get the same affinity every time. This combines the documented start syntax with a normal Windows shortcut.

  1. Right-click an empty spot on the desktop and choose New > Shortcut.
  2. For the location, enter: cmd.exe /c start "" /affinity 3 "C:\Program Files\Encoder\encoder.exe"
  3. Click Next, give the shortcut a name such as Encoder (2 cores), and click Finish.
  4. Launch the program from this shortcut, then check the Details page in Task Manager to confirm the affinity.

A Command Prompt window may flash briefly before the program opens. Opening the program any other way (Start menu, a file double-click, an update that relaunches it) starts it with all processors again.

Check or Change Affinity With PowerShell

PowerShell can read and set the same value through the .NET ProcessorAffinity property, which is handy for scripts. Open PowerShell and run (Get-Process encoder).ProcessorAffinity to see the current mask as a decimal number. To change it, run (Get-Process encoder).ProcessorAffinity = 3, using the process name without .exe.

Microsoft’s documentation notes a few rules that also explain common errors: the property works only for processes on the local computer, it fails if the process has already exited, and it raises an error when the affinity could not be set. If several processes share the name, the command returns all of them, so target one by its process ID with Get-Process -Id 1234 instead.

Affinity Versus Priority

Right next to Set affinity in the Details menu, you’ll usually find Set priority. The two do different jobs:

  • Affinity controls where a process can run (which processors).
  • Priority controls who goes first when processes compete for the same processor.

For a background encode, lowering its priority to Below normal is often enough, because it still uses every core when nothing else needs them and steps aside when you’re busy. Affinity is the firmer limit. The start command accepts priority switches too (/low, /belownormal, /normal, /abovenormal, /high and /realtime), so you can combine both, for example start "" /belownormal /affinity F "C:\Program Files\Encoder\encoder.exe". Avoid Realtime: Microsoft’s process priority documentation says a realtime process can preempt even important operating system work and can leave the mouse unresponsive.

When Setting Affinity Fails or Backfires

  • Access is denied. Windows system processes, security software and processes running under another account may refuse the change. Try running Task Manager or PowerShell as an administrator; some protected processes still can’t be changed, and that’s by design.
  • The setting keeps disappearing. That’s expected. Affinity belongs to the running process, so it resets whenever the program restarts. Use the shortcut method instead.
  • The program got slower. Fewer processors means less total power for that program. Add processors back until the balance works for you.
  • The program ignores your change. Some apps manage their own threads or spawn helper processes that start with full affinity. Check whether the busy work is happening in a different process on the Details page.
  • The start command opens nothing. Check the empty title quotes, the full program path in quotes and that the mask is written in hexadecimal (for example F, not 15).

Processor Affinity Questions

Will Limiting Cores Make a Game Run Faster?

Usually not directly. Restricting the game itself normally takes power away from it. The benefit comes from restricting the other heavy program so the game has more processors to itself.

What Happens If I Set the Mask to Zero?

In PowerShell, Microsoft’s ProcessorAffinity page says a value of zero hands scheduling back to the operating system. In Task Manager, a process needs at least one processor, so the dialog may not let you clear every box.

Why Can’t I Find Set Affinity?

You’re probably on the Processes page. Switch to Details and right-click the process there. If the option is there but the change fails, the process is usually protected or running under another account.

Start with Task Manager to find a split that works, then turn that choice into a start /affinity shortcut so you don’t have to set it again after every restart.