ThisCalculator

Everyday

Terraria Server Port: Find and Change It

Updated · Standard formula, shown below

Terraria Server Port: Find and Change It

To find your Terraria server port, check the server console output when it starts, which typically shows the port as 7777. To change it, edit the server configuration file (serverconfig.txt) and modify the port line, then restart the server. This article explains the default port, where to find it, how to change it for both the base game and tModLoader, and how to troubleshoot common connection issues.

Default Port and How Terraria Networking Works

Terraria uses a single TCP port for all multiplayer traffic. The default port is 7777, which is used by both the base game and tModLoader. When you start a server, it listens on this port for incoming connections. The server console displays the port it is using, and the client needs to know this port to connect. If you are hosting a server, you may need to forward this port on your router so players outside your local network can join.

Finding the Port Your Server Is Using

There are several ways to find the port your Terraria server is currently using:

  • Server console: When you launch the server, the console window prints a line like Listening on port 7777. This is the most direct method.
  • Configuration file: If you use a serverconfig.txt file, it contains a port= line. The server reads this file on startup.
  • Client side: When you host a game from the main menu (Host & Play), the game automatically uses port 7777 unless you changed it in the settings.
  • For tModLoader: The tModLoader server also uses port 7777 by default, but you can set a different port in its serverconfig.txt located in the tModLoader folder.

How to Change the Port in the Base Game

Changing the port is straightforward, but the exact steps depend on how you start your server.

  1. Locate the serverconfig.txt file. This file is usually in the same folder as the server executable (e.g., TerrariaServer.exe). If it does not exist, you can create one with a text editor.
  2. Edit the port line. Open the file and find the line port=7777. Change the number to your desired port (e.g., port=8888). Save the file.
  3. Start the server. When you launch the server, it will read the config file and use the new port. The console will confirm the new port.
  4. If you do not use a config file: You can start the server and when it prompts for settings, you can type the port number directly. The server will ask for the port after you choose the world.

Note: If you are using the “Host & Play� option from the main menu, you cannot change the port directly in the game UI. You must use a dedicated server or edit the config file that the game uses (usually serverconfig.txt in the game folder).

Changing the Port in tModLoader

tModLoader servers work similarly. The config file is named serverconfig.txt and is located in the tModLoader server folder. If you are using the tModLoader client to host, you can change the port in the tModLoader settings under Multiplayer before hosting. For a dedicated tModLoader server, edit the port line in its config file.

Common Problems and Troubleshooting

If you change the port and players cannot connect, check these common issues:

  • Firewall: Your operating system firewall may block the new port. You must allow inbound connections on the new port for the Terraria server executable.
  • Router port forwarding: If you are hosting from home, you need to forward the new port on your router to your computer’s local IP address. The old port forwarding rule for 7777 will not work.
  • Client connection: Players must enter the correct port when connecting. In the multiplayer join menu, they can type IP:port (e.g., 192.168.1.10:8888). If they only enter the IP, the game defaults to port 7777.
  • Port already in use: If another application is using the port you chose, the server will fail to start. Choose a different port or close the conflicting application.
  • Config file not read: Ensure the config file is named exactly serverconfig.txt and is in the same directory as the server executable. Also, restart the server after editing.

Choosing a Port: Best Practices

When selecting a new port, consider the following:

  • Use a port above 1024, as lower ports may require administrator privileges.
  • Avoid well-known ports like 80 (HTTP) or 443 (HTTPS) to prevent conflicts.
  • Pick a port that is not already used by another game or service on your network.
  • If you run multiple Terraria servers, each must use a different port.

A common choice is a port in the 7777–8000 range, but any unused port works.

Port Forwarding and Network Configuration

To allow players outside your local network to join, you must forward the chosen port on your router. The process varies by router brand, but generally:

  1. Find your router’s local IP address (often 192.168.1.1 or 192.168.0.1).
  2. Log in to the router’s admin panel.
  3. Look for a section called “Port Forwarding� or “Virtual Server.�
  4. Create a new rule: enter the port number (e.g., 7777) for both external and internal ports, select TCP protocol, and enter your computer’s local IP address.
  5. Save the rule and restart the router if necessary.

Also, ensure your computer has a static local IP, or the forwarding rule may break when your IP changes. You can set a DHCP reservation in your router settings.

Frequently Asked Questions

What port does Terraria use by default?

The default port is 7777 for both the base game and tModLoader. This is the port the server listens on unless you change it.

Can I use any port number?

Yes, you can use any port from 1 to 65535, but it is best to use a port above 1024 to avoid system services and permission issues. Also, the port must not be in use by another program.

Why can’t my friend connect after I changed the port?

Your friend must enter the new port when connecting. They should type the IP address followed by a colon and the port (e.g., 123.45.67.89:8888). Also, check that your firewall and router forward the new port.

Does the port change affect the client?

No, the client does not have a fixed port. The client connects to the server’s IP and port. The client’s own port is random and does not need to be configured.

How do I find the port if I forgot what I set it to?

Check the server console output when you start the server. It will display the port it is listening on. Alternatively, look at the serverconfig.txt file for the port= line.

Is it safe to use port 7777?

Using port 7777 is safe in the sense that it is a standard port for Terraria, but it is also a common target for port scanners. Changing it to a non-standard port can reduce automated attacks, but it is not a security measure. Always use a firewall and keep your server software updated.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.