← All tools

CPU Affinity Mask Calculator

Turn a hexadecimal CPU mask into a CPU list, or toggle CPUs to build the mask and copy the matching commands.

1–1024, as the kernel numbers them (nproc)
Optional 0x prefix; bit 0 is CPU 0
Comma-separated, e.g. 0-3,6,7
Toggle CPUs

A mask is a bitmap of logical CPUs: bit n set means CPU n is allowed, and taskset -p prints the mask as a bare hexadecimal number with the lowest bit last. Leading zeros do not change a mask. This page models up to 1024 logical CPUs, the kernel's CPU_SETSIZE, with exact big-integer arithmetic, so 64-bit and larger masks are not truncated. Hyperthread siblings count as separate logical CPUs, so allowing CPU 0 and CPU 1 may pin a process to one physical core. A parent cpuset, the cgroup v2 cpuset.cpus file (comma-separated, ranges allowed, as generated here) or cpuset.effective_cpus can still reduce the set, and taskset rejects an empty mask. CPU numbering and the accepted syntax also depend on the kernel version and the tool reading it, so check the command against your own system. Commands are shown as text only; nothing is executed and nothing leaves your browser.