Tor browser proxy for specific country.

Reading Time: 3 minutes
Tor browser logo
Image from:

Recently, I had a task for testing some country specific features and I found out that there’s a limited amount of free services to set up a proxy for a predefined country. Mostly, people use proxies, because they don’t want to have their IPs from a specific country, due to country regulations and so on, but having an IP from specific country is a bit reverse logic, but as testers we have to do stuff like this, sometimes. So, one way to do so, of course having limitations on its own, is using Tor browser.

What’s Tor and Tor browser in first place.

I am not pretending to be extremely familiar with Tor and all it specifics, but on a pretty high level Tor is a network of proxy nodes. It has a couple of different node types – relay, bridge and the Tor browser itself. What it does, simply said, is to bounce your connection between many such “nodes” in the Tor network, to hide the origin of the connection e.g. make it anonymous. There’s a lot of talk and disputes, whether or not Tor really provides internet anonymity or it’s a dud, if it is reliable and so on, but for the purpose of this blog post, I won’t dive deeper into details about Tor. The reason why I am using it – it works as proxy and we can manipulate it in order to perform some localization testing.

Downloading Tor browser.

You can download Tor browser from its official page – Downloads. The installation is pretty straight forward, for Windows there’s a .exe file you can install and on Linux there’s a .gz archive you can download and place in whatever directory you need it. I will be mainly focused on Linux, since that’s what I used, but things shouldn’t differ in the other platforms as well.

See also  Today we fight back against mass surveilance

Starting Tor browser.

That’s fairly simple as well, in the directory where you downloaded it, there.s a .desktop file which invokes a run script, so you can simply double-click it, or just run it as a shell script with “./”. Now, if you want to see what your address is you could navigate to: and check your address. With each restart of the browser you will find, that a random IP address is assigned. But there’s a trick to use, to make our IP-based on a specific location.

Manipulating country settings.

For that purpose you will need to navigate to the following folder in your Tor browser installation folder:

~/tor-browser_en-US/Browser/TorBrowser/Data/Tor and what you need is the file called torcc. When you open it you will see something like that:

# This file was generated by Tor; if you edit it, comments will not be preserved
# The old torrc file was renamed to torrc.orig.1 or similar, and Tor will ignore it

DataDirectory /home/assassin/tor-browser_en-US/Browser/TorBrowser/Data/Tor
GeoIPFile /home/assassin/tor-browser_en-US/Browser/TorBrowser/Data/Tor/geoip
GeoIPv6File /home/assassin/tor-browser_en-US/Browser/TorBrowser/Data/Tor/geoip6

Let’s say we want to set our IP to UK. For that purpose we need to add the following two lines:

# This file was generated by Tor; if you edit it, comments will not be preserved
# The old torrc file was renamed to torrc.orig.1 or similar, and Tor will ignore it

ExitNodes {GB} # sets the country to GB
StrictNodes 1 # forces the connection to use exactly these exit nodes

DataDirectory /home/assassin/tor-browser_en-US/Browser/TorBrowser/Data/Tor
GeoIPFile /home/assassin/tor-browser_en-US/Browser/TorBrowser/Data/Tor/geoip
GeoIPv6File /home/assassin/tor-browser_en-US/Browser/TorBrowser/Data/Tor/geoip6

We can practically put any country code in the brackets in order to make it work, for a specific country. Save the file, start Tor browser again and check your IP again. It’s set to UK, voila!

See also  Wordpress docker container on your local PC.

Known issue:

Since the Tor network and Tor browser are not proprietary software and the Tor nodes are simply machines set up by hobbyists. We can’t rely any location will be available to set our proxy to. The network needs some minimum amount of nodes to the desired location in order to establish a full circuit. So, for some countries you might not be able to connect.

So, hope that article was interesting and informative for you, if you liked it don’t forget to comment and share. Thanks 😉

Please follow and like us:


Senior software engineer in testing. The views I express here are mine, they don't represent any position held by any of my employers. Experience in mobile, automation, usability and exploratory testing. Rebel-driven tester, interested in the scientific part of testing and the thinking involved. Testing troll for life. Retired gamer and a beer lover. Martial arts practitioner.

More Posts - Website

Follow Me:

3 thoughts on “Tor browser proxy for specific country.”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.