How do I set the number of threads in XMRig?
You can set XMRig’s CPU thread count with --threads=N when you start it, or by editing the RandomX thread list in config.json. For a saved setup, editing the configuration is usually the clearest option, because an existing thread profile can take priority over automatic settings.
Set threads when you launch XMRig
A thread is one worker running mining calculations on your processor, or CPU. To request four CPU mining threads, open a terminal in your XMRig folder and run:
./xmrig --threads=4
On Windows, use:
.\xmrig.exe --threads=4
The shorter form, -t 4, does the same thing. Keep your usual pool and wallet settings; these examples only show the thread option.
This option controls the thread count used during automatic CPU configuration. If your configuration already contains an explicit RandomX thread profile, edit that profile instead of assuming the command-line option will replace it.
Set an exact count in config.json
Stop XMRig and make a backup of config.json. Open the file in a plain-text editor, then find the "cpu" section.
For Monero, look for "rx", the profile for RandomX, Monero’s mining algorithm. A simple four-thread setup looks like this:
"cpu": {
"enabled": true,
"rx": [-1, -1, -1, -1]
}
This is a section of the configuration, not a complete configuration file. Keep your other settings and make sure the commas fit the surrounding file.
Each entry creates one mining thread:
[-1, -1]means two threads.[-1, -1, -1, -1]means four threads.- Six entries mean six threads.
Here, -1 means the thread is not pinned to a particular CPU location. Your operating system decides where it runs.
You may instead see numbers such as [0, 2, 4, 6]. Those also represent four threads, but each number assigns a thread to a specific logical CPU—the numbered processing units your operating system sees.
If an "rx/0" profile exists, check it too: an algorithm-specific profile can override the general "rx" profile for Monero.
Choose a count your CPU can handle
More threads do not always mean faster mining. RandomX benefits from roughly 2 MB of L3 cache per mining thread. L3 cache is a small, fast memory area inside your CPU.
For example, 16 MB of L3 cache makes eight threads a reasonable starting point, not a guaranteed optimum. CPU design, available memory, and other programs also affect performance.
Try a lower count first if you use the computer while mining. Compare:
- Hashrate: how many mining calculations you complete per second.
- CPU temperature and fan noise.
- How responsive your computer feels.
Restart and verify the result
Save the file and restart XMRig. Check its startup output for the RandomX profile and active thread count.
If the count is wrong, confirm that you edited the configuration file XMRig actually loads. Also check for a more specific profile.
Do not confuse --cpu-max-threads-hint with an exact count. It guides automatic configuration; it is not a strict CPU-usage limit.
The bottom line
Use --threads=4 for automatic configuration, or four entries in the active RandomX profile for a saved four-thread setup. Restart, verify the count, and test nearby settings for the best balance of speed, heat, and everyday usability.
