How to Set Up a Terraria Dedicated Server (1.4.5)
A Terraria dedicated server keeps your world online when nobody is playing. Here is how to pick the right way to host, set the server up on Windows or Linux, let friends in, and keep the world saved.
Fastest setup. The host player must stay in game, and the world stops when they leave.
Best no-monthly-cost persistent option. TerrariaServer runs the world separately from the game and gives you console commands.
Good if you want the server online without relying on your home PC or router, and do not mind Linux shell admin.
Simpler day-to-day for a public or long-running world. You trade manual system admin for a monthly bill.
Choose your path before you set anything up
Start by deciding how available the world needs to be. A lot of setup pain comes from building a dedicated server when Host & Play would have done the job, or from trying to use Host & Play for a world that really needs to stay online after the host logs off.
| Host & Play | Dedicated on your PC | VPS | Rented server | |
|---|---|---|---|---|
| World stays up after you quit the game | No | Yes | Yes | Yes |
| Works with your PC switched off | No | No | Yes | Yes |
| Home router port forwarding needed | Partly | Yes | No | No |
| Console commands (save, kick, ban) | No | Yes | Yes | Yes |
| Free to run | Yes | Yes | No | No |
- Use Host & Play or Steam friends mode if the host will always be present, the world can shut down when the host leaves, and you do not need a server console. This is the least admin-heavy path. The trade-off is that progress stops with the host, and a bad exit can lose the last few minutes of changes.
- Use a dedicated server on your own PC if the world should stay up without any player being connected. TerrariaServer has no graphical requirement, runs separately from the game, and gives you save, kick, ban and password commands. The trade-off is that your PC and upload connection become part of the service.
- Use a VPS if you want the world online independently of your home PC and you are happy managing files, permissions, a firewall and a terminal session. This removes home-router dependence, but puts the admin burden on you.
- Use a rented server if the world is public, long-lived, or you do not want to maintain Windows tasks, tmux sessions, backups and router rules yourself. The trade-off is monthly cost, but the operational work is usually lighter.
A simple rule: if any one of these matters, move to a dedicated server now: the host should not need to stay in game, you want a clean exit save path, or you want predictable admin control over passwords and bans.
Windows setup: the first launch wizard
On Windows, TerrariaServer.exe lives in your Terraria install folder, commonly C:\Program Files (x86)\Steam\steamapps\common\Terraria. In Steam, right-click Terraria, open Properties, then Local Files, then Browse. You should see TerrariaServer.exe, serverconfig.txt, start-server.bat and start-server-steam-friends.bat.
- Run
TerrariaServer.exe. The first run opens a text console and lists any worlds it can see. Existing world files are usually inDocuments\My Games\Terraria\Worlds. If you skip this and launch the normal game instead, you are back in Host & Play land, not a true dedicated server. - Pick or create a world. This decides which
.wldfile the server keeps in memory and writes back on save. If you pick the wrong one, the server still starts, but everyone joins the wrong map and you can easily think progress has vanished. - Set max players. This is the connection cap, not a promise of performance. More players means more entity updates, more chest and tile changes to synchronise, and more bandwidth. For a friends world, keep it near the real headcount instead of leaving it wide open; the example config uses
8, and the default cap since 1.4.0.1 is16. - Set the port. The default is
7777. Leave it alone unless another service already uses it, or you plan to run more than one Terraria server on the same machine. If you change it and forget to tell clients, they will connect to the wrong place and time out. - Answer the automatic port forwarding prompt. This is Terraria asking to try UPnP on your router. Say yes if you are on a home connection and want the easiest first attempt, but do not assume it worked; plenty of routers block or ignore UPnP requests. On a VPS or rented server, this is not the right tool anyway.
- Set a password if internet players are joining. A password does not make the server public-safe on its own, but it does stop random joins from anyone who has your IP and port. Leaving it blank is fine for a trusted LAN test, not for a forwarded home server.
If Windows Firewall prompts you, allow TerrariaServer.exe or create a rule for the port. If you skip that, the server can look healthy locally while every external join attempt fails.
Make it repeatable with a config file
The wizard is fine once. After that, use a config file so the server always starts the same world with the same limits. Copy serverconfig.txt before editing it, because lines starting with # are ignored and the original file is a useful reference. If you forget to remove the #, Terraria silently ignores that setting and falls back to defaults or prompts.
The most important rule here is that world= makes startup predictable. Without it, you are back to a manual world picker. If world= is wrong and autocreate= is enabled, the server can generate a fresh world instead of loading the one you expected, which is handy for first deployment but risky for an established save.
| Line | What it does | Friends world | Public world |
|---|---|---|---|
world= | Exact .wld file to load on start. | Set it explicitly. | Set it explicitly. |
autocreate= | Creates a world if the one above is missing: 1 small, 2 medium, 3 large. | Usually blank once the world exists. | Useful only for first build or scripted redeploys. |
worldname= | Name used when auto-creating a world. | Optional. | Optional but tidy if you automate creation. |
difficulty= | World difficulty: 0 classic, 1 expert, 2 master, 3 journey. | Match the group’s chosen world. | Decide before launch and keep it stable. |
maxplayers= | Connection cap; valid range is 1-255. | Keep near the real group size. | Raise only as far as CPU, RAM and bandwidth allow. |
port= | Listening port; default is 7777. | Leave at 7777 unless you need another. | Leave at 7777 unless you run multiple servers. |
password= | Join password. | Set one for any internet-facing private world. | Blank for public, set for private staff/testing worlds. |
motd= | Message shown on join. | Short reminder or server note. | Use it for rules or support info. |
secure=1 | Enables extra cheat protection. | Leave on. | Leave on. |
upnp=1 | Lets Terraria try automatic port forwarding. | Fine on home internet as a first attempt. | Usually off when you already forward manually or use hosted infrastructure. |
priority= | Process priority: 1 High, 3 Normal and so on. | 3 Normal if you also use the PC. | 1 High or 2 AboveNormal on a dedicated box. |
npcstream= | NPC update streaming. Lower means less enemy skipping but more bandwidth; 0 turns it off. | Start with the default 60. | Start with 60 and only lower it if players report skipping. |
Why priority matters: it changes who wins CPU time when the machine is busy. It does not create more CPU; it only tells the scheduler to favour Terraria. That can smooth a dedicated machine, but on your everyday PC it can make the rest of Windows feel sluggish.
Why npcstream matters: it trades bandwidth for smoother enemy movement. Lower values send more frequent NPC state updates, which can reduce apparent teleporting for remote players. The cost is more data to every client. If uploads become the bottleneck, everyone lags together instead of only seeing skipped enemies.
world=C:\Users\You\Documents\My Games\Terraria\Worlds\Friends.wld maxplayers=8 port=7777 password=replace-this motd=Friends world - use exit to shut down cleanly secure=1 upnp=1 priority=3 npcstream=60
TerrariaServer.exe -config friends-server.txt
If you keep the default file name, start-server.bat is convenient because it starts with serverconfig.txt and restarts the server if it crashes. If you run more than one world on one machine, each server needs its own config file, its own world file and its own port.
Linux or VPS setup
For a VPS, the clean path is the current dedicated server zip, extract it under a non-root user, then keep the process inside tmux. That matters because the Terraria server is just a console process; if your SSH session dies and it was attached to that shell, the world dies with it.
# as root: create a user for game servers adduser terraria su - terraria # copy the dedicated server zip from terraria.org here, then: unzip terraria-server-1458.zip cd 1458/Linux chmod +x TerrariaServer.bin.x86* export TERM=xterm tmux new -s terraria ./TerrariaServer.bin.x86_64
Detach from tmux with Ctrl+b then d, and return with tmux attach. If the server will not start and you later see Magic number is wrong: 542 in client-crashlog.txt, the TERM=xterm export is the first fix. Open 7777 in the OS firewall and in any cloud security group as well; missing the provider-side rule is a common reason a healthy server is still unreachable. On cloud platforms, open 7777 for both TCP and UDP.
A dedicated user is worth doing even for a small server. It limits the damage if you make a file-permission mistake later, and it keeps game files separate from the rest of the system. On non-x86 hardware such as a Raspberry Pi, run the Windows build through Mono instead: mono --server --gc=sgen -O=all ./TerrariaServer.exe. On a Mac, use the Mac folder from the same zip; Apple Silicon Macs need Rosetta 2, and macOS may ask you to remove the download quarantine with xattr -d com.apple.quarantine before the server will open.
Letting friends in: local, LAN, internet and Steam
Test access in layers. If you jump straight to public internet joins, you cannot tell whether the problem is the server, the firewall or the router.
localhost on the server PC?- Same PC: join
localhost. This proves TerrariaServer itself is running and listening. - Same LAN: join the server PC’s IPv4 address. On Windows use
ipconfig; on Linux useip addr. This proves the local firewall is not blocking the game. - Over the internet: give friends your public IP and the port, usually
7777. This only works after the router forwards7777TCP to the server PC.
Manual port forwarding is still the reliable route for a home dedicated server. Give the server machine a static or reserved local IP first, then point the router forward at that address. If you skip the reservation, the router can later hand the PC a different local address and your forward silently points at the wrong device.
UPnP sometimes fails because the router does not support it properly, has it disabled, or refuses the request. Terraria asks about automatic forwarding because it is convenient when it works, but it is not something to trust blindly for a long-running world. Also remember the machine firewall: the router can pass traffic correctly and Windows can still drop it.
Public IPs on home internet can change. If friends had a working saved entry and it suddenly dies after a reboot or provider change, the IP may simply be stale.
If everyone is on Steam and this is a private PC group, Terraria includes start-server-steam-friends.bat, or you can launch with -steam -lobby friends. That is the simplest no-public-listing route for a friends world, but it is not the usual choice for a public persistent server.
Persistent worlds and saving without losing progress
Terraria’s saving behaviour is good once you understand it, but it will punish lazy shutdowns. The server auto-saves at dawn in game, which comes round every 24 minutes of real time. Since 1.4.5.0 it also saves when the last player leaves, and it saves on shutdown only when you use the exit command.
| Event | World saved? |
|---|---|
| Dawn in game (every 24 minutes) | Yes |
| Last player leaves (1.4.5.0 and later) | Yes |
save command | Yes |
exit command | Yes |
exit-nosave command | No |
| Closing the console window with X | No |
- Use
exitto shut down. That triggers a save and clean close. Clicking the console window’s X or killing the process can lose the last few minutes of world changes, including chest transfers. - Know what
exit-nosavedoes. It shuts the server down without saving. That is useful when you want to throw away the last few minutes, for example after a mistake, and a disaster if you type it by habit. - Use
savebefore risky moments. Good times include OS updates, moving files, swapping configs, or before a long building session you do not want to repeat. The cost is a brief disk write burst, which is trivial compared with losing progress. - Back up the
.wldfile. On Windows, worlds live inDocuments\My Games\Terraria\Worlds. On Linux, use~/.local/share/Terraria/Worlds. Copying the world file is the simplest rollback point. - Save before copying for backup. Otherwise your backup may just preserve the old state. The safe pattern is
save, then copy the file.
When nobody is online the server hibernates, and since 1.4.5.7 an empty server only starts updating again once a player has fully connected. That keeps idle resource use low, but it also means time does not pass in an empty world: crops, the day-night cycle and NPC arrivals all wait for the first player.
Running the server day to day
All console commands are typed without a slash. They matter because they give you a clean save path and live admin control that Host & Play does not.
| Command | What it does | When you would use it |
|---|---|---|
help | Lists commands. | Quick reminder while you are in the console. |
playing | Shows connected players. | Check who is online before a restart or password change. |
save | Writes the current world state to disk. | Before maintenance or any risky admin change. |
exit | Saves and shuts down cleanly. | Always use this for planned shutdowns. |
kick player | Removes a player from the server. | Stuck connections or behaviour issues. |
ban player | Bans a player and writes to banlist.txt. | Repeat troublemakers on public worlds. |
password newpass | Changes the server password live. | Rotate access after sharing it too widely. |
motd text | Changes the join message. | Temporary notices such as restart warnings. |
say message | Broadcasts a server message. | Warn players before restarts or saves. |
port, maxplayers, time, version | Shows current runtime information. | Useful when checking the live state against your config. |
Players can use /playing in chat, but console admin commands stay on the server side. To unban someone, remove their name and IP from banlist.txt. Password changes take effect from the server side, which is much safer than restarting just to update one line.
How much server does Terraria need?
The official baseline is modest: 500 MB free RAM for a small world. After that, world size and player count drive what the server needs. Larger worlds hold more tile data in memory and take longer to save and back up, while more players create more entity, chest and movement updates to synchronise.
- Small:
4200 x 1200tiles,5,040,000total tiles - Medium:
6400 x 1800tiles,11,520,000total tiles - Large:
8400 x 2400tiles,20,160,000total tiles
A large world has 4 times the tiles of a small one, so it is not just “a bit bigger”. For hosted plans, the rough guidance from our comparison is 512MB-1GB RAM for a vanilla small group, 1-2GB for a vanilla public server, and 3-4GB minimum for tModLoader.
Mods change the picture quickly. tModLoader is a separate server package for content mods such as Calamity or Thorium, and TShock is a different path for plugins and admin tooling; you run one or the other, not both. If you are planning a modded setup, start with our modded Terraria hosting guide instead of treating vanilla sizing as a safe estimate.
Hosting for mobile players
On a phone or tablet, Multiplayer has two options. Local hosts a world over your Wi-Fi for up to 8 players, and the hosting device needs at least 1 GB of RAM. Online joins a server: add it by IP and port, the same details PC players use. A server only accepts players on its own game version, so a group mixing phones and PCs needs a server set up for both. Our Terraria mobile hosting page covers the setups that let phones and PCs share a world.
First troubleshooting pass
When something breaks, do not change five things at once. Check local join, then LAN join, then internet join. That order tells you which layer is failing.
| Symptom | Likely cause | First fix |
|---|---|---|
| Friends time out | No port forward, blocked firewall, stale public IP, or the forward points at the wrong local IP. | Confirm the server works on localhost, reserve the server PC’s local IP, forward 7777 TCP to it, and allow the server through the firewall. |
| Server not starting on Linux | Wrong folder, missing execute permission, wrong binary, or the process dies with the shell. | Run from 1458/Linux, use chmod +x TerrariaServer.bin.x86*, start the x86_64 binary, and keep it inside tmux. |
| World rolled back | Console closed with the window X, process was killed, or no manual save before maintenance. | Use save before changes and exit for shutdown; restore the latest .wld backup if needed. |
| Can’t find world | Looking in the wrong folder, wrong world= path, or the server auto-created another world. | Check the world locations, point world= at the right .wld, and disable autocreate once the real world exists. |
| Wrong port | Clients are using 7777 but the server was changed, or another server already uses that port. | Check the live port with port or the config file, then join with the matching port number. |
| Magic number is wrong | Terminal type issue on Linux. | Run export TERM=xterm before starting the server again. |
Self-host, VPS or rented: choose the admin burden you can actually keep up with
| Question | Host & Play / Steam friends | Own PC dedicated | VPS | Rented server |
|---|---|---|---|---|
| Must your home PC stay on? | Yes, and you must stay in the game. | Yes, but you do not need to stay in-game. | No. | No. |
| Does your home upload matter? | Yes. | Yes. | No. | No. |
| Router and port forwarding work? | Usually less of an issue with Steam friends mode. | Yes for public internet joins by IP. | No home-router work, but you still handle firewall rules. | Usually no home-router work. |
| Who restarts it when it stops? | The host relaunches the world. | You manage the PC and the server process. | You manage the process and OS. | The host keeps the machine running; you restart the server from a web panel. |
| Who handles backups? | You copy the local world file. | You copy the .wld file. | You copy the .wld file from the server. | You should still keep your own world backups. |
| Best fit | Casual sessions where the host is always present. | Private persistent world with no monthly bill. | Always-on world for someone comfortable in Linux. | Public or persistent world with less system admin. |
If a monthly cost is the deal-breaker, self-hosting is the obvious first step, and there are also free Terraria server hosting options with their limits explained. If you want a persistent world without leaving your own machine awake and reachable, our Terraria server hosting comparison is the faster way to weigh panel quality, backups and plan size; the cheapest paid plan there is £3.60/month ($4.80).
If you have already decided that Host & Play is too limited and self-hosting is more work than you want, compare the practical differences between paid Terraria server plans before you commit.
Compare the best Terraria server hostsTerraria server FAQ
Is a Terraria dedicated server free?
Yes, the dedicated server software is free to use, and running it on your own PC does not add a hosting bill. What is not free is the machine, electricity and internet connection behind it. VPS and rented servers are paid options because someone else is providing the always-on hardware and network.
What port does a Terraria server use?
The default port is 7777. For a home dedicated server, that is the port you normally forward on the router and allow through the firewall. On some cloud platforms, you may also need matching provider firewall rules for 7777 beyond the guest OS firewall.
Why can’t my friends join my Terraria server?
The usual causes are a wrong IP, wrong port, no port forward, a blocked firewall, or a public IP that has changed. Test in order: localhost, then LAN IPv4, then public IP. If LAN works and internet does not, the problem is almost always forwarding or firewall rather than the world file itself.
Does a Terraria server keep running when I log off?
A dedicated server does, as long as the machine and the server process stay running. Host & Play does not; that world ends when the host leaves the session. On Linux, a detached tmux session keeps the process alive after you disconnect, but a sleeping PC will still take the world offline.
How many players can join a Terraria server?
The default max players is 16 since 1.4.0.1, and the config supports 1-255. That is only the cap, though: the practical limit depends on world size, mods, bandwidth and how much public traffic you expect. For a private world, set the cap close to the real group size so the server is not needlessly exposed.
More Terraria server guides
Our other Terraria server guides, plus the host comparison.
Written for Terraria 1.4.5 (dedicated server 1.4.5.8). On a rented server the ports, world files, config lines and console commands are the same; only the control panel around them differs.