How to Port Forward a Minecraft Server: Step-by-Step for Java & Bedrock (2026)

To port forward a Minecraft server, log in to your router and forward TCP port 25565 (Java Edition) or UDP port 19132 (Bedrock Dedicated Server) to the local IP address of the PC running the server. Then allow the server through your firewall and give friends your public IP address. The whole setup takes about 15 minutes once the server itself runs.

Quick answer: 1) Get the server PC’s IPv4 address (ipconfig) and reserve it in your router. 2) In the router’s Port Forwarding page, forward 25565 TCP (Java) or 19132 UDP (Bedrock) to that IP. 3) Allow the port in Windows Firewall. 4) Start the server and test from outside your network with your public IP. If your router’s WAN IP doesn’t match your public IP, you’re behind CGNAT and port forwarding won’t work.

Before you start

Java Edition server Bedrock Dedicated Server
Default port 25565 19132 (IPv4), 19133 (IPv6)
Protocol TCP UDP
Software Official server.jar from minecraft.net (or Paper, Fabric etc.) Bedrock Dedicated Server from minecraft.net
Needs Java 25 for Minecraft 26.1 and newer Windows or Ubuntu

You also need access to your router’s admin page. Port forwarding is only needed for players outside your home network. People on the same Wi-Fi can join with your local IP, or through Open to LAN.

1. Get the server running locally

  1. Make a new folder, download the server software into it, and (for Java) install a matching Java version.
  2. Java: start it once with a command such as java -Xms2G -Xmx2G -jar server.jar nogui (adjust the memory to what your PC can spare). It stops and creates eula.txt.
  3. Open eula.txt, change eula=false to eula=true, save, and start the server again.
  4. In Minecraft, add a server with the address localhost and join it. If this doesn’t work, fix it before touching the router. If you see “Failed to bind to port”, see this fix.

2. Find and fix the server PC’s local IP

  1. On Windows, open Command Prompt and run ipconfig. Note the IPv4 Address (often 192.168.x.x or 10.x.x.x) and the Default Gateway (your router’s address). On macOS or Linux, check network settings or run ip addr.
  2. In your router, find DHCP reservation (also called static lease or address reservation) and reserve that IP for the server PC. Otherwise the IP can change after a restart and your port forward stops working.

3. Add the port forwarding rule on your router

  1. Type the Default Gateway address into a browser and log in. The default login is often printed on a sticker on the router; some ISPs use an app instead.
  2. Find Port Forwarding. It may be under Advanced, NAT, Firewall, Virtual Server or Gaming.
  3. Create a rule:
    Field Java Bedrock
    Name Minecraft Minecraft Bedrock
    External / internal port 25565 19132 (add 19133 for IPv6)
    Protocol TCP (TCP/UDP also works) UDP
    Device / internal IP The server PC’s reserved IP from step 2
  4. Save or apply. Some routers need a restart.

If you change the port in server.properties, forward that port instead.

4. Allow the port through the firewall

Windows may block incoming connections even with the router set up. Allow Java (javaw.exe/java.exe) or the Bedrock server, or add an inbound rule for the port. Full steps: how to allow Minecraft through Windows Firewall.

5. Check server.properties

  • server-port=25565 (Java) or server-port=19132 (Bedrock) must match the forwarded port.
  • Leave server-ip= blank unless you know you need it. A wrong value here is a common cause of servers that can’t be reached.
  • online-mode=true (Java) keeps account checks on. Leave it on.

Restart the server after editing the file.

6. Test the server and share your address

  1. Find your public IP by searching “what is my IP” on any device on your network.
  2. With the server running, use an online open-port checker on your public IP and port, or ask a friend to join.
  3. Test from outside your network (for example, a phone on mobile data with Bedrock). Many routers don’t let you join your own public IP from inside the network.
  4. Friends join with yourpublicIP:25565 on Java (the port can be left off if it’s 25565), or your public IP and port 19132 on Bedrock.

Home public IPs can change. A dynamic DNS service gives you a hostname that follows your IP so friends don’t need a new address each time.

Not working? Go through our port forwarding not working checklist. For “Connection refused” errors, see the io.netty fix, and for “Unknown host”, the Unknown Host fixes.

CGNAT and other blockers

  • CGNAT: compare the WAN/Internet IP on your router’s status page with your public IP. If they’re different (or the WAN IP starts with 100.64–100.127), your ISP shares one public IP between customers and port forwarding can’t work. Ask your ISP for a public IPv4 address, or use a hosted server or Realms instead.
  • Double NAT: an ISP modem-router plus your own router. Put the ISP device in bridge mode, or forward the port on both.
  • ISP blocks: some ISPs block incoming connections on certain plans. Try a different external port (for example, 25570) forwarded to the server’s port.

Keep your server safe

  • Forward only the Minecraft port. Never use your router’s DMZ option for a game server.
  • Turn on the whitelist on Java with /whitelist on and add friends with /whitelist add name. Bedrock uses allow-list=true in server.properties and /allowlist add.
  • Keep the server software and Java up to date.
  • Back up the world folder regularly.

More useful admin commands are in our Minecraft commands list.

FAQ

Do I need to port forward for Open to LAN?

No. LAN worlds only work on the same network. Port forwarding a LAN world is unreliable because its port changes every time unless you set one.

Is port forwarding safe?

Opening one port for a Minecraft server is generally low-risk if you keep the server updated, use a whitelist and don’t forward anything else.

Can Bedrock console players join a port-forwarded server?

Xbox, PlayStation and Switch players can’t add custom servers directly. They usually join through the featured servers list, a Realm, or workarounds that aren’t officially supported.

Why can’t I join with my public IP but friends can?

Your router may not support NAT loopback. Join with your local IP or localhost instead.

Our guides are researched, fact-checked and updated as games change. How we research and verify our guides.