Tor is one of the most important tools for anonymous browsing. While its standard configuration is great for hiding your web activity, you will have to make some alterations if you want your data to travel through nodes in specific countries. This article will show you how to change Tor country codes on Windows, Mac and Linux.

Thankfully, it’s easy to set up.  By the end of this guide, you’ll be able to send web traffic from Albania to Zambia, all without leaving your house.

Why would you want to change your country code in Tor?

When you run Tor normally, your web traffic enters the network at a random node, bounces around a number of different relays and leaves from a randomly chosen exit node, onward to your target destination. This process helps to hide where data originates from, which gives anonymity to internet users.

Anonymous browsing is great, but there are also situations where users want their data to travel through certain locations. Some people want to spoof their identity or the location that their data originates from.

As examples, an activist in Guatemala may want their internet traffic to look like it comes from someone that lives in Belgium, in order to protect themselves and hide from the authorities. Likewise, a Cuban artist may want to pose as a New Zealander to get around some of the government’s restrictions.

Changing the country codes allows people in these situations to choose the specific countries that they want their data to go through. It’s relatively easy to change the settings as well, which means that anyone with an internet connection can do it.

Disadvantages of using Tor country codes

If you select very specific countries, particularly those without many Tor nodes, you may not be able to connect successfully. If you can, the connection may be unstable and difficult to use. In general, the more you limit your selection of nodes, the poorer your connection will be.

Tor country codes vs. VPNs for spoofing your location

Altering Tor country codes can be a great way to spoof your location, but it’s not the only way, or the most suitable in many situations. VPNs can be much more effective for many different use cases.

If your priority is anonymity, and you don’t want to have to trust a third party like a VPN provider, then Tor may be the best option for geo-spoofing. It’s free, but generally quite slow, and is a good choice for activism and related uses.

If you want to spoof your location so that you can watch geo-restricted Netflix or something similar, you should use a VPN instead of the Tor network. The first reason is practical—your connection will be much faster over a reliable VPN.

The other main issue is that the Tor network is an important tool for many activists, dissidents and others that need its anonymity for their own safety. Tor is already under a lot of strain because there aren’t enough nodes for the number of people that want to use it.

Many would view it as unethical if you were to cause even more strain on an already struggling network just so you can watch Game of Thrones. If this is the only reason you want to spoof your location, it’s best to get a VPN.

How to change your Tor country code in Windows, Mac or Linux

Changing your country codes involves a slightly different setup for each system, but once you have done that, the country coding process is the same.

Changing Tor Country code in Windows

The first step to changing the country codes in Tor is to download and install the browser. Before you start modifying the codes, you need to make sure that you have run Tor at least once beforehand. This makes the torrc file appear, which you need for changing the nodes that Tor is running through.

Once the installation is complete, you will need to double click the Tor icon to open the browser, then hit Connect in the screen that pops up. Once you have connected, the torrc file will be available, and you can move on with the rest of the process as follows.

Regular Tor users (and those new users who have just connected Tor for the first time) can get started by looking for the torrc file. To find it, double click on the Browser folder, then double click on the TorBrowser folder inside that.

In the TorBrowser folder, there is another folder called Data. Double click on it. Here, you will see another folder called Tor. Double click on it as well. This brings you to the torrc file:

Double click on the torrc file to open it. In the window that appears, it will ask you to choose which program you want to open the file with. Select Notepad which will bring up the following window:

Once you’ve done this, you can skip ahead to the section called Putting the Tor country codes into the text editor.

Changing Tor Country code on a Mac

Just like with Windows, you need to make sure that you have run Tor at least once beforehand for the torrc file to appear. If you haven’t already done so, download the Tor Browser and install it. Once it has been set up, open the browser and click Connect.

Once Tor has been connected at least once, you will need to find the torrc file. First, head to the Go tab, then click on Go to Menu, which appears in the submenu:

Look up your Tor folder with the following address:

Once you are inside the folder, locate the torrc file. Double click on it, then select TextEdit from the Open With options:

It will open up the following file:

From this point, you can move ahead to the section named Putting the Tor country codes into the text editor.

Changing Tor Country code with Linux

Before you begin, you will need to have set up Tor and run it at least once. You can download the Tor Browser from the Tor Project’s website, then run the setup. Open the browser, then click connect, so that the torrc file will appear.

Once this has been done, you can locate the torrc file by opening the Tor Browser folder, then heading from the Browser subfolder to TorBrowser, then to Browser, and then finally to the Tor folder.

Open the torrc file with your usual text editor to bring up the file. This is where you will be able to add in your desired country codes. It will look much the same as the Notepad and TextEdit files shown in the Windows and Mac sections above, respectively. Once you have done this, you can move onto the next section.

Putting the Tor country codes into the text editor

Now that you have opened the file (in either Windows, Mac or Linux), it’s time to look up the entry and exit nodes that you would like to use in Tor. Head to the following link at SCCM Rookie to find the codes for the countries you want to connect through. Each country code is made up of two letters in between the brackets {}:

As an example, the country code for Argentina is ar, while the code for Bangladesh is bd. In this tutorial, we will be using the Netherlands {nl}, Germany {de}, the United States {us}, Singapore {sg} and Australia {au} as both our entry and exit nodes. For other country codes, scroll through the page linked above.

Once you have found the country codes you are looking for, head back to the Notepad file (for Windows), Text Edit file (for Mac), or whichever text editor you used (if you are changing your country codes in Linux), that we opened before. Click underneath the last line of text and type in the following (including the spaces after both “EntryNodes” and “ExitNodes”, but without spaces between each country code):

EntryNodes {nl},{de},{us},{au},{sg}

ExitNodes {nl},{de},{us},{au},{sg}

The EntryNodes code specifies which entry nodes you would like Tor to use. The ExitNodes code does the same, but for exit nodes. Be aware that under these settings, Tor can still use nodes in other countries between the entry and exit.

If Tor cannot connect properly using any of the specified entry and exit nodes, it will revert to other nodes, which could force your data to travel through undesirable locations.

See the Other useful Tor country codes section at the end of the article if you want to see some other options. These include codes that can be used to exclude nodes, and those that can force Tor to only use certain nodes, even if that means that the connection will otherwise fail.

It should look like this in Windows:

Or like this in Mac:

Remember to substitute the {nl}, {de}, {us}, {au}, and {sg} for the country codes of your choice.

When you have finished with your selections, do the following:

  • Windows – Click File in the top left corner of Notepad, then Save as… In the box that comes up, go to the Save as type option at the bottom and choose All Files. Then click on the torrc file, followed by Save and Yes:

  • Mac – Hit Command and S at the same time to save the file, then close it.

  • Linux – Save the file as you normally would (this will depend on which text editor you are using).

Now that you have altered and saved the torrc file, launch your Tor Browser. Go to the website of your choice. In this case, we will head to Wikipedia. To the left of the URL, you will see a small icon with an i in a circle:

Click on it to see the circuit that your connection is making. If you have done things correctly and Tor can connect through the selected countries, you will see that your traffic is using your chosen entry and exit nodes. In this case, the Tor connection is running through Germany and the Netherlands.

As you can see, changing the country codes in Tor is a simple process, allowing you to spoof your location easily. Under the settings listed above, you can select any nodes that you like, and Tor will ideally send your traffic through those entry and exit nodes. If it cannot make a stable connection using them, then it will revert to other nodes.

Other useful Tor country codes

Using the above settings is not ideal for every use case. In some situations, it may be best to exclude the nodes that you don’t want to use, rather than set the nodes that you want to include. For example, you may only want to exclude exit nodes in the United States.

Excluding nodes

To do this, follow the exact same process as above, but instead of using the EntryNodes and ExitNodes codes from earlier, use ExcludeExitNodes. You would type the following into the torrc file in Notepad:

ExcludeExitNodes {us}

If you wanted to exclude multiple exit nodes, you would just separate them with commas as we did earlier. In other situations, you may want to exclude certain nodes from being used as entry points, exit points or anywhere in between. To do this, you use the ExcludeNodes code in the same way:

ExcludeNodes {us}

StrictNodes

By using the codes above by themselves, you still run into the problem that Tor can revert to using excluded nodes if it cannot make a stable connection in any other way. If you would prefer to not connect at all, rather than connect through certain locations, you need to add in the StrictNodes code. You can place it underneath any of the codes mentioned above.

With a StrictNodes setting of 1, Tor will only connect through your specified nodes (and avoid those that you have excluded). If it cannot successfully connect through these specified nodes, then it will fail, rather than revert to nodes that have been excluded.

With a StrictNodes setting of 0, Tor will avoid the excluded nodes if possible. If it cannot make a stable connection on allowed nodes, it will revert to other nodes in order to function properly.

You can use the StrictNodes setting by entering any of the other codes that we mentioned above (EntryNodes, ExitNodes, ExcludeExitNodes, ExcludeNodes) into the torrc file in Notepad, followed by whichever country codes you choose to either include or exclude.

You then enter StrictNodes in the following line, with a 1 if you only want certain nodes to be used, even if that results in a failed connection. If you would prefer Tor to stay connected, even if it means using undesirable nodes, enter a 0 instead.

As an example, if you absolutely don’t want Tor to use any nodes based in the United States, you would enter the following:

StrictNodes 1

Tor’s country code options are flexible, allowing you to connect in whichever way suits your purposes and risk profile. Some users will value being able to stay connected no matter which nodes are being used, while others may worry about their security if their traffic goes through certain locations. Thankfully, it’s easy to set up in a way that matches your needs.