How to Host a Valheim Server: Step-by-Step Guide
This guide shows you how to set up your own Valheim dedicated server, either on your own PC or on a separate machine, so you and your friends can play together on a persistent world that stays online even when you’re not in the game. You’ll need the game itself, a Steam account, and a computer that can run the server (the same machine you play on works for small groups). By the end, you’ll have a private server with your own settings and mods if you want them.
What You’ll Need
- A Windows, Linux, or macOS computer (Windows is easiest; macOS works but has extra steps).
- Steam installed and logged in.
- Valheim purchased on Steam (you need it to generate the server files, but the server itself is free).
- At least 4 GB of free RAM and 2 GB of disk space for the server files.
- Port forwarding access to your router (if you want friends outside your local network to join).
- Optional: a static IP or a dynamic DNS service if you plan to host long-term.
Step-by-Step
- Install the Dedicated Server via Steam: Open Steam, go to Library, and select Tools from the dropdown menu. Find Valheim Dedicated Server and click Install. Wait for it to download.
- Locate the Server Files: After installation, right-click Valheim Dedicated Server in your Library, select Manage > Browse local files. Note the folder path (usually
C:\Program Files (x86)\Steam\steamapps\common\Valheim dedicated server). - Run the Server Once (Windows): In that folder, double-click
start_headless_server.bat. A console window will open and generate the world files. Once you see “Game server connected” or similar, close the window. This creates the necessary config files. - Configure the Server: Navigate to
...\Valheim dedicated server\valheim_server_Dataand openstart_headless_server.batwith a text editor (right-click > Edit). You’ll see lines with-name "My Valheim"and-world "Dedicated". Change the name and world to your preference. Set a password with-password "YourPassword"(must be at least 5 characters). Save the file. - Set Up Port Forwarding (if needed): Log into your router’s admin page (usually 192.168.1.1 or 192.168.0.1). Find Port Forwarding or Virtual Server. Create rules to forward TCP and UDP port 2456 to the local IP of the computer running the server. Also forward ports 2457 and 2458 (Valheim uses 2456-2458). Use the same external and internal ports.
- Start the Server: Run
start_headless_server.batagain. Keep the console window open. The server is now running. You’ll see log lines showing it’s listening on port 2456. - Join the Server: In Valheim, select Join Game, then click Add Server. Enter your server’s IP address (your public IP if friends are joining, or your local IP if only you) and port
:2456(e.g.,192.168.1.50:2456). Enter the password and connect. - Test with Friends: Have a friend try to join using your public IP. If it fails, check your firewall and port forwarding (see Troubleshooting).
Common Mistakes
- Forgetting to forward all three ports: Valheim uses 2456, 2457, and 2458. Forwarding only 2456 will cause connection issues.
- Using the wrong IP: Friends need your public IP, not your local one. You can find it by searching “what is my IP” on Google.
- Password too short: The server requires a password of at least 5 characters. Shorter ones will cause startup failure.
- Closing the console window: Closing the server window stops the server. Use a tool like Screen on Linux or just keep the window open.
- Not updating the server: After Valheim updates, the server may become incompatible. Re-run the Steam update for the Dedicated Server tool.
Tips
- Use a separate machine: Running the server on the same PC you play on can cause lag. If you have an old PC or a spare laptop, dedicate it to the server.
- Set a static IP: Assign a static local IP to the server machine in your router’s DHCP settings so port forwarding doesn’t break after a reboot.
- Back up your world: Regularly copy the world files from
...\Valheim dedicated server\valheim_server_Data\worldsto a safe location. This prevents loss of progress. - Use a launch script for Linux: On Linux, create a shell script with the same parameters as the batch file, and run it with
nohuporscreento keep it alive after logout. - Adjust server settings: You can add
-public 0to make the server not appear in the community list, and-savedirto change where world files are stored.
Troubleshooting
- Friends can’t connect: First, verify your server is running and you can join locally. Then check your firewall: Windows Defender may block the server. Add inbound rules for ports 2456-2458 (TCP/UDP). Also confirm your public IP hasn’t changed (many ISPs assign dynamic IPs).
- Server won’t start: Read the console output. Common errors include: password too short, world name invalid (no spaces?), or missing Steam authentication. Make sure you’re running the batch file from its own folder, not from a shortcut elsewhere.
- High ping or lag: This is often due to the server machine’s internet upload speed. Valheim requires about 5 Mbps upload for 5-10 players. Also ensure no other heavy downloads are running.
- World resets or doesn’t save: The server saves automatically every 30 minutes, but if you close the console window abruptly, recent changes may be lost. Use the
savecommand in the console (type ‘save’ and press Enter) to force a save before shutting down. - Server not visible in community list: If you set
-public 0, it won’t show. Also, Steam servers can take a few minutes to appear. Check your port forwarding again.
Frequently Asked Questions
Can I host a Valheim server on the same PC I play on?
Yes, but it will use extra RAM and CPU. For 2-3 players, it’s fine. For larger groups, use a separate machine to avoid performance issues.
Do I need to buy Valheim again for a dedicated server?
No. The dedicated server tool is free on Steam. You only need one copy of the game to host and play.
How many players can join a dedicated server?
Valheim supports up to 10 players on a dedicated server. Performance depends on your hardware and internet speed.
Can I use mods on a dedicated server?
Yes, but all players must have the same mods installed. You’ll need to install mods on the server as well, and use a mod loader like BepInEx.
How do I update my Valheim server?
In Steam, right-click the Dedicated Server tool and select Update. Then restart the server. Your world files remain intact.
What is the default port for Valheim?
Valheim uses UDP/TCP port 2456 by default, with 2457 and 2458 for additional services. You must forward all three.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.