How to Set Tor Exit Nodes to a Specific Country
It is entirely possible to configure the Tor network to route your
internet traffic exclusively through exit nodes located in a specific
country. By modifying the core Tor configuration file, known as
torrc, you can specify target countries using two-letter
ISO country codes and force the client to strictly adhere to those
geographical parameters. This guide outlines the exact configuration
directives required, how to apply them, and the privacy implications of
doing so.
Step 1: Locate the
torrc File
To change your exit node settings, you must first locate and edit the
torrc configuration file on your system.
- Tor Browser (Windows):
Browser\TorBrowser\Data\Tor\torrc - Tor Browser (macOS): Right-click the Tor Browser
application, select “Show Package Contents”, and navigate to
Contents/Resources/TorBrowser/Tor/torrc(or check~/Library/Application Support/TorBrowser-Data/Tor/torrc). - Tor Browser (Linux):
tor-browser_en-US/Browser/TorBrowser/Data/Tor/torrc - Linux (System Daemon):
/etc/tor/torrc
Step 2: Add Country Directives
Open the torrc file in a standard plain-text editor
(such as Notepad, TextEdit, or Nano). Scroll to the bottom of the file
and add the following lines:
ExitNodes {cc}
StrictNodes 1
Replace {cc} with the two-letter ISO 3166-1 alpha-2 code
of your desired country (enclosed in curly braces).
Examples:
United States:
ExitNodes {us} StrictNodes 1Germany:
ExitNodes {de} StrictNodes 1Multiple Countries (e.g., Canada, Switzerland, United Kingdom):
ExitNodes {ca},{ch},{gb} StrictNodes 1
Understanding the Directives
ExitNodes: Instructs Tor to prefer exit relays located within the specified country codes. You can specify single countries, comma-separated lists of countries, or specific relay fingerprints.StrictNodes 1: Forces Tor to strictly enforce your node preferences. If set to1, Tor will refuse to connect to the internet if no exit nodes are available in your specified country. If omitted or set to0, Tor will fall back to other countries if your chosen location is unavailable.
Step 3: Apply and Verify
- Save the changes to the
torrcfile. - Restart the Tor Browser or the Tor daemon service
(
sudo systemctl restart toron Linux). - Visit an IP verification site (such as
check.torproject.orgor any standard geolocation service) to confirm that your exit IP address is registered to the chosen country.
Important Security Considerations
Restricting your exit nodes to a single country limits the size of the relay pool available to your client. This can reduce your overall anonymity by making traffic analysis easier for network-level adversaries. Additionally, if the specified country has limited Tor exit capacity, you may experience slower browsing speeds or connection failures.