Minecraft

How to Change Minecraft Server Port (and When Not To)

The default Java port is 25565. Here is how to move it on your own PC, how players connect to a custom port, and why a hosted server already has its port set.

TheGameHosting Team 5 min read
Change Your Minecraft Server Port
Background: Minecraft © Mojang Studios

To change Minecraft server port on a server you run yourself, stop it, open server.properties, set server-port= to the new number (for example server-port=25566), save, allow that port in your firewall and router, and start the server again. Players then join with your-address:25566. On a hosted server the port is usually assigned by the panel, so you copy it instead of changing it. This guide covers both cases.

The default port for Minecraft Java Edition is 25565 (TCP). Bedrock Dedicated Server uses 19132 (UDP). When a server uses the default, players can type the address without a port; any other port has to be added after a colon.

Why change the Minecraft server port?

  1. Run two servers on one machine. Two servers cannot listen on the same port. The second one needs 25566 or another free number.
  2. Your internet provider or network blocks 25565. Rare, but it happens on some shared networks.
  3. Another program already uses the port. The server fails at startup with **** FAILED TO BIND TO PORT! and the hint "Perhaps a server is already running on that port?".

Changing the port does not make the server more secure. Bots scan every port; use a whitelist to control who joins.

Change the Minecraft server port in server.properties

These steps are for a server running on your own PC or machine.

  1. Stop the server with the stop command so the world saves.
  2. Open server.properties in the server folder with a text editor.
  3. Find server-port=25565 and change the number, for example to server-port=25566. Use a number between 1024 and 65535 that nothing else uses.
  4. If you use enable-query=true, set query.port to the same number or another free one. If you use RCON, rcon.port must be different from the game port.
  5. Save the file and start the server. The console prints "Starting Minecraft server on *:25566".
  6. Allow the new port (TCP) in your computer's firewall.
  7. Forward the new port in your router to your PC's local IP. Our guide on how to port forward a Minecraft server walks through it.
  8. Share the address with the port: 203.0.113.10:25566.
server.properties
server-port=25566
query.port=25566
server-ip=

Leave server-ip empty unless you know you need it. Filling it with the wrong address is a common reason a server stops accepting connections after a port change.

How players connect to a custom port

In Minecraft, open Multiplayer, then Add Server, and type the address with a colon and the port, with no spaces: play.example.com:25566. If you use the default 25565, the port can be left out.

To share a clean address without a port, create a DNS SRV record on your domain (_minecraft._tcp) that points to the host and port. Java players then type only play.example.com. Our guide on a Minecraft server custom domain explains the record. Bedrock does not read SRV records, so Bedrock players always need the port.

Changing the port on a hosted server

On a hosted panel the port is part of the server's network allocation (an IP and port pair). On TheGameHosting you see it in the Network tab and on the server's main page. The panel writes that port into the server's settings each time it starts, so changing server-port in server.properties does not move the server: the file goes back to the assigned port, or the server tries to use a port it was not given and players cannot reach it.

  1. Open your server in the panel and go to Network.
  2. Copy the address and the port shown there.
  3. Give players that exact address and port, or point a domain at it with an SRV record.
  4. If your tab shows an additional port, you can use it for an add-on such as voice chat or Geyser. If it does not and you need one, ask support by ticket.
  5. If you need a different main port for a specific reason, open a ticket and explain it; do not edit server-port yourself.

There is no router to configure and no firewall rule to add. That is the main reason most people stop running servers on their own PC.

Common errors after a port change

What you seeCauseFix
FAILED TO BIND TO PORT!Another server or program is using the portPick another free port or stop the other program
"Connection timed out"Firewall or router does not let the port throughAllow the port in the firewall and check the port forward
"Connection refused"Wrong port typed, or the server is not runningCheck the console line "Starting Minecraft server on"
Works at home, not for friendsPort not forwarded, or you shared your local IPForward the port and share your public IP
Hosted server stops being reachableserver-port was edited by handPut back the port shown in Network and restart

For timeouts in general, see Minecraft server connection timed out.

Skip the port setup with TheGameHosting

Running a server at home means picking ports, writing firewall rules, forwarding them on the router and keeping the PC on. On TheGameHosting the server gets its address and port when it is created, about 60 seconds after payment, and it runs 24/7 on AMD 9950X or 7950X3D CPUs with a 10 Gbps network in Dallas or Amsterdam. DDoS protection is included on every plan, so your public address is not an open door for attacks.

Java plans start at 2 GB for $1.90 USD per month with no charge per player. See all sizes on Pricing or read about our Minecraft server hosting.

FAQ

What port does a Minecraft server use?

Java Edition uses TCP port 25565 by default, and Bedrock Dedicated Server uses UDP port 19132. Both can be changed in server.properties.

How do I change the port of my Minecraft server?

Stop the server, set server-port= to a free number in server.properties, save, allow the port in your firewall and router, and start the server again.

How do players join a server with a custom port?

They type the address followed by a colon and the port, for example play.example.com:25566. With an SRV record on your domain, Java players can leave the port out.

Can I change the port on a hosted Minecraft server?

On most panels the port is assigned to the server and the panel sets it on every start. On TheGameHosting you see it in Network; ask support by ticket if you need a different one.

Hosting for this game

Written by TheGameHosting Team, the people who run our servers in Dallas and Amsterdam and answer your tickets.

All posts