Terraria guide

Terraria serverconfig.txt Explained: Every Setting and Value

By the ChicagoServers team · Updated · 7 min read

Terraria's dedicated server reads serverconfig.txt at startup. The keys that matter most are world (which world file to load), autocreate and worldname (to generate a new one), difficulty, maxplayers, port (7777 by default) and password. A line that starts with # is a comment and is ignored, so remove the # to enable a setting.

Everything here was checked against the Terraria Wiki's server page, which documents Desktop 1.4.5 (released 27 January 2026), on 2026-11-01. Terraria's server is simple, but a few values are easy to get wrong, and those are called out below.

Quick answer
  • world= loads an existing world file; autocreate= (1 small, 2 medium, 3 large) only creates one if none is found.
  • difficulty=, seed= and worldname= only apply when a world is being auto-created. Values: 0 Classic, 1 Expert, 2 Master, 3 Journey.
  • maxplayers must be between 1 and 255; the port defaults to TCP 7777.
  • Anything starting with # is a comment, and a commented line does nothing.
  • Stop the server with the exit command so the world is saved.
On this page
  1. Where serverconfig.txt is used
  2. All serverconfig.txt keys
  3. How world, autocreate and difficulty interact
  4. Three common setups
  5. Language codes
  6. Ports, saving and stopping the server
  7. Common mistakes
  8. Frequently asked questions
  9. References

Where serverconfig.txt is used

On Windows, start-server.bat starts the server using serverconfig.txt. On Linux you run ./TerrariaServer.bin.x86_64 (the x86 binary on 32-bit) and can point at your file with -config. Many of the same options can also be passed as command-line parameters; the table below lists both forms where the wiki documents one.

Example for a Linux server. Replace the path and values with your own.
# serverconfig.txt - a lightly annotated working example
world=/home/terraria/.local/share/Terraria/Worlds/MyWorld.wld
autocreate=2
worldname=MyWorld
difficulty=0
maxplayers=16
port=7777
password=ChangeThis
motd=Welcome to the server
secure=1
language=en-US

All serverconfig.txt keys

KeyWhat it doesCommand-line form
world=Path to a world file to load. The server starts straight into it.-world
autocreate=Creates a world if none is found at that path. 1 = small, 2 = medium, 3 = large.-autocreate
seed=Seed for the auto-created world.-seed
worldname=Name of the auto-created world.-worldname
difficulty=Difficulty of the auto-created world: 0 Classic, 1 Expert, 2 Master, 3 Journey.none listed
maxplayers=Player limit, 1 to 255. The wiki gives 16 as the default (8 before 1.4.0.1).-maxplayers or -players
port=Listening port. Default 7777 (TCP).-port
password=Server password. Leave empty for none.-password or -pass
motd=Message of the day shown on join.-motd
worldpath=Folder where world files are stored.none listed
banlist=Path of the ban list. Defaults to banlist.txt in the working directory.-banlist
secure=1 adds additional cheat protection.-secure
language=Server language code (see below).none listed
upnp=1 forwards ports automatically with UPnP. Irrelevant on a hosted server.-noupnp disables it
npcstream=Reduces enemy skipping at the cost of more bandwidth. 0 turns it off; the wiki's example is 60.none listed
priority=Process priority: 0 Realtime, 1 High, 2 AboveNormal, 3 Normal, 4 BelowNormal, 5 Idle.-forcepriority

Other command-line options from the wiki include -ip (address to listen on), -steam and -lobby friends|private (Steam join support), -disableannouncementbox, and -announcementboxrange (use -1 for server-wide messages).

How world, autocreate and difficulty interact

This is where most confusion comes from. There are two ways to give the server a world, and they behave differently:

  • Existing world: set world= to the file. The server loads it and keeps its type. difficulty, seed and worldname are ignored.
  • New world: set autocreate= and let world= point to a file that does not exist yet. The server generates a world using worldname, seed and difficulty, and saves it to that path.

That means changing difficulty= on a server that already has a world does nothing. You would need to point at a new file name or remove the old world (take a backup first). World size values are 1 for small, 2 for medium and 3 for large.

Journey is difficulty=3, which the wiki notes was added alongside Master in Desktop 1.4.0.1. Journey worlds have their own per-power permission keys, covered in the difficulty and Journey guide.

Three common setups

These put the rules above together. All values are examples.

Existing world
# 1. Load an existing world, no auto-creation
world=/home/terraria/.local/share/Terraria/Worlds/MyWorld.wld
maxplayers=16
port=7777
password=ChangeThis
motd=Welcome back
New Expert world
# 2. Create a new large Expert world the first time, then reuse it
autocreate=3
worldname=Expert1
difficulty=1
seed=hello
world=/home/terraria/.local/share/Terraria/Worlds/Expert1.wld
maxplayers=10
port=7777
Public server
# 3. Public server with extra cheat protection and more bandwidth for smoother enemies
world=/home/terraria/.local/share/Terraria/Worlds/MyWorld.wld
secure=1
npcstream=60
maxplayers=16
language=en-US

In setup 2 the world is created once. On later starts the file exists, so the server loads it and difficulty, seed and worldname are not used again. Higher npcstream values reduce enemy skipping but cost bandwidth, so raise it only if players actually see skipping.

Language codes

The wiki lists these supported values for language=. Use them exactly:

CodeLanguage
en-USEnglish
de-DEGerman
it-ITItalian
fr-FRFrench
es-ESSpanish
ru-RURussian
zh-HansChinese
pt-BRPortuguese
pl-PLPolish

Ports, saving and stopping the server

  • Port. The wiki says the server runs on TCP 7777 by default, and the port must be forwarded if you host from behind a router. Change it with port= or -port.
  • Autosave. The wiki says the world is saved automatically at dawn, about every 24 minutes. Since Desktop 1.4.5.0 the server also saves when the last player leaves.
  • Stopping. Use exit in the console so the world saves; exit-nosave discards recent changes. Closing the window is risky for the same reason.

Hosting with ChicagoServers? The Terraria server hosting page lists what is included, such as free server backups and SFTP file access. Free server backups cover you if a bad edit corrupts something.

Common mistakes

  • Leaving the # in front of a key. The line is a comment and the server uses its default instead.
  • Expecting difficulty to change an existing world. It only applies at creation.
  • Setting maxplayers above 255 or below 1, or assuming the example values in a sample file are defaults. They are examples.
  • Typing a language name ("English") instead of a code (en-US).
  • Windows paths on Linux. Sample files often use Windows-style folders. Replace them with real paths on your machine.
  • Forgetting the version match. Players need a client on the same Terraria version as the server.

Frequently asked questions

What is the default port for a Terraria server?

7777. The Terraria Wiki says the server runs on TCP port 7777 by default; change it with port= in serverconfig.txt or -port on the command line.

Why does my Terraria server ignore the difficulty setting?

The difficulty key only applies when the server is creating a world with autocreate. If a world file already exists at the world path, it keeps the difficulty it was created with.

What are the world size and difficulty values in serverconfig.txt?

autocreate: 1 small, 2 medium, 3 large. difficulty: 0 Classic, 1 Expert, 2 Master, 3 Journey.

How many players can a Terraria server hold?

The maxplayers setting accepts 1 to 255. The Terraria Wiki lists 16 as the default (it was 8 before 1.4.0.1), but actual capacity depends on the server's resources.

References