Setting Up a .onion Website in Tor
📅 Historical Content Notice: This article was originally published in January 2018 and describes Tor v2 hidden services. Tor v2 .onion addresses are now deprecated and no longer supported. Modern Tor hidden services use v3 addresses with ed25519 cryptography and 56-character addresses. For current setup instructions, please refer to the official Tor Project hidden service guide.
Introduction
In this post, we’ll explore the process of setting up a website with a .onion domain within the Tor network. A .onion domain1 operates differently from traditional domains as it doesn’t rely on an IP mapping, thus preserving the anonymity of the hidden server. The creation of an .onion address involves generating a public key from a private RSA key, followed by hashing through the now-outdated SHA-1 algorithm2, and then encoding it with Base 323 to produce the distinctive .onion domain (e.g., http://oxoujukneztb6wxg.onion). It’s important to note that Base 32 encoding does not include uppercase letters or special symbols.
.onion Hidden Service Setup Process
graph TD
A[Install Web Server<br/>e.g., XAMPP, Nginx] --> B[Download Tor<br/>Expert Bundle]
B --> C[Run tor.exe<br/>Initialize Tor]
C --> D[Create torrc<br/>Configuration File]
D --> E{Configure<br/>HiddenServiceDir<br/>HiddenServicePort}
E -->|HiddenServiceDir C:\hidden| F[Set Key Directory]
E -->|HiddenServicePort 80 127.0.0.1:81| G[Map Ports]
F --> H[Restart Tor]
G --> H
H --> I[Tor Generates<br/>Private Key]
I --> J[Tor Creates<br/>.onion Address]
J --> K[Find hostname<br/>in HiddenServiceDir]
K --> L[Hidden Service Active!<br/>yoursite.onion]
style A fill:#4CAF50
style D fill:#2196F3
style H fill:#FF9800
style J fill:#9C27B0
style L fill:#4CAF50
Configuration Example:
HiddenServiceDir C:\hidden_service
HiddenServicePort 80 127.0.0.1:81
Key Points:
- No Public IP Required: Hidden services work without exposing your IP
- Port Mapping: Left port = hidden service, right port = local web server
- Automatic Key Generation: Tor creates private_key and hostname files
- Anonymous Hosting: Visitors cannot determine server location

Note: Building an
.onionwebsite does not require a public IP address and does not involve adding port rules to your firewall.
Step-by-Step Guide to Setting Up an .onion Website
-
Website Setup: Start by creating a website on your computer. A simple way to do this is by downloading XAMPP4 and setting it up quickly.
-
Downloading Tor: Next, go to the Tor Project website and download the “Expert Bundle” for Windows5. Avoid selecting the browser bundle.
-
Installation and Configuration: After downloading, unzip the files and locate
tor.exe. Run it once and then close it. Navigate to the folderC:\Users\[Your Username]\AppData\Roaming\tor. Here, create a text file namedtorcc, remove the file extension, and open it with a text editor. Add the following lines:HiddenServiceDir C:\ # This will be the directory for your website's private and public key files. You can change the location if desired. HiddenServicePort 80 127.0.0.1:81 # The left number indicates the port for the hidden service, and the right one links to your local port.
-
Launching the Hidden Service: Save the changes and run
tor.exeagain. Congratulations, your hidden service should now be operational! The.oniondomain name will be listed in theHiddenServiceDirfolder’s public key file. Ensure to safeguard your private key, while the public key can be discarded as Tor will regenerate it with each operation.
References
Enjoy Reading This Article?
Here are some more articles you might like to read next: