How to Fix "Can't Connect to Server" in Minecraft
To fix "Can't connect to server" in Minecraft, check four things in order: the server is running, the address and port are typed exactly right, your game version matches the server, and nothing blocks the connection (firewall, port forwarding or a VPN). The exact error message tells you which one it is, and the table below maps each message to its fix.
1. Read the exact error first
"Can't connect to server" is the title of the screen, not the cause. The line under it is the clue. Look at it before you change anything.
| What you see | Usually means | Go to |
|---|---|---|
Connection timed out or getsockopt | The server is off, asleep, or a firewall or port is blocking you | Steps 2 and 5 |
Connection refused | Nothing is listening on that address and port | Steps 2 and 3 |
Unknown host or Can't resolve hostname | The address is misspelled or the domain has no DNS record | Step 3 |
Outdated client or Outdated server | Your game version and the server version differ | Step 4 |
Failed to verify username | Your login session expired | Step 6 |
You are not whitelisted on this server | The whitelist is on and you are not on it | Step 6 |
Incompatible mod set or a mod channel error | Your mods do not match the server's mods | Step 6 |
Unable to connect to world (Bedrock) | Wrong port, wrong edition or no crossplay set up | Step 7 |
2. Check that the server is actually running
Most "can't connect" reports come down to a server that is not on. Open your server's console or panel and look for a line like Done (12.3s)! For help, type "help". If you do not see it, the server is still starting or has stopped.
- A big modpack can take a few minutes to start. Wait until the console says it is done.
- If the console shows red errors and the server stopped, it crashed. Read the lines above the stop: they usually name the plugin or mod at fault.
- If you host at home, the computer must stay on and the server window must stay open. Closing the window stops the server.
- Sleeping servers are a special case. A host that sleeps empty servers starts them when someone joins, and the first attempt can show a message or time out while it starts. Try again after about 30 seconds. Our post on servers that sleep when empty explains how that works.
3. Check the address and port
A single wrong character is enough to fail. Copy the address instead of typing it by hand.
- Java Edition uses TCP port 25565 by default. If the server uses that port, you can leave it off:
play.example.comworks. - If the port is different, add it after a colon:
play.example.com:25570. Without it the game tries 25565 and getsConnection refusedor a timeout. - Bedrock Edition uses UDP port 19132 by default. Java and Bedrock use different protocols, so a Java address does not work in Bedrock unless the server has crossplay set up.
- There must be no
http://and no spaces. Use only the name or IP, plus:portif needed. Unknown hostmeans the name does not resolve. If you set up your own domain, wait for DNS to update (it can take from a few minutes up to a day) and check the records. See how to give your server a custom domain.- On the machine running the server, join with
localhost. If that works but friends cannot join, the problem is the network, not the server.
4. Match the game version to the server version
Java Edition servers only accept clients on a compatible version. If the server runs 1.21.4 and you launch 1.20.1, you get Outdated client. If you are newer than the server, you get Outdated server.
- In the Minecraft launcher, open Installations and pick the same version the server runs.
- Or change the server to the version your players use. Back up first. The steps are in how to change the Minecraft version of your server.
- Paper and Purpur servers can accept some other client versions with a plugin such as ViaVersion. That is optional and only needed when your players are on mixed versions.
- Modded servers need the same loader (Fabric, Forge or NeoForge) and the same mods on both sides.
5. Fix the network if you host at home
A server on your own computer is reachable from your own house but not from the internet until you open it up. This is the usual cause when you can join with localhost and nobody else can.
- Port forwarding. In your router settings, forward TCP port 25565 to the local IP of the computer running the server. Give that computer a fixed local IP so the rule keeps working.
- Firewall. Allow Java (or the server program) through Windows Firewall or your Linux firewall for TCP 25565. On Linux with ufw that is
sudo ufw allow 25565/tcp. - Public IP. Friends need your public IP, not the
192.168.x.xaddress. Search "what is my IP" from the server computer. It can change when your router restarts. - CGNAT. Some internet providers share one public IP between many homes, so port forwarding cannot work. Ask the provider for a public IP, or use a hosted server instead.
server-ipinserver.properties. Leave it empty unless you know you need it. A wrong value here makes the server listen on the wrong address and givesConnection refused. All the settings are covered in server.properties explained.
If you are tired of fighting a router, a hosted server skips all of this, because the address works from anywhere. See the features page for what Tree Host includes.
6. Fix account, whitelist and mod problems
Failed to verify usernameorInvalid session. Restart the launcher, sign out and sign in again. If Mojang's login service is down, wait a few minutes.You are not whitelisted on this server. An admin must add you with/whitelist add YourName. See how to whitelist a Minecraft server.You are banned from this server. An admin can lift it with/pardon YourName.The server is full. Themax-playerssetting inserver.propertiesis the limit (default 20). Raise it or ask someone to leave.Incompatible mod set. Install the same mods, at the same versions, as the server. A client with extra or missing mods is turned away.Internal Exception: java.io.IOException: An existing connection was forcibly closed. Often a mod or plugin crashed on join, or a proxy or VPN cut the connection. Check the server console at the moment you join.
7. Bedrock players and crossplay
If a friend on a phone, tablet or console cannot join a Java server, that is expected. Bedrock and Java are different games and speak different protocols. A Java Paper server can accept Bedrock players if you add Geyser and Floodgate, and then Bedrock players use UDP port 19132 (or the port you set) along with the server's address. Without that setup, Bedrock shows Unable to connect to world.
8. Quick test to find which side is broken
- Join from the same computer with
localhost. Fails: the server itself has a problem. Read the console. - Join from another device on the same Wi-Fi using the local IP. Fails: firewall on the server computer.
- Join from a phone on mobile data using the public address. Fails: router, port forwarding or CGNAT.
- Everything works for you but not for one friend: check their version, their mods, the whitelist and whether they are banned.
- Still stuck: make a copy of the console log at the time of joining. A line with the player's name and a reason almost always names the cause.
For problems that only show up under load, see our guide on how to fix Minecraft server lag, because a server that is too slow to answer can also time out joiners.
How Tree Host helps
On Tree Host the server address and port are shown at the top of the server page, so you can copy them instead of typing. There is no router to configure. The troubleshooting guide lists the same join errors with fixes, and you can read the live console to see why a join failed. Creating your own servers opens at launch. Anyone signed in can try the shared demo server now, and pre-launch payments are covered by a full refund if Tree Host does not launch. See the plans when you are ready.
Tree Host gives you a ready address, a live console and sleep-when-empty hosting, so there is no router to set up.