Port forwarding lets friends outside your home connect to a Minecraft server running on your computer. You tell your router to send Minecraft traffic to that computer. It takes about ten minutes, and when it will not work, the cause is usually one of a few things covered below.

Which port does a Minecraft server use?

Default Minecraft server ports
ServerPortProtocol
Java Edition25565TCP
Bedrock Dedicated Server19132 (IPv6: 19133)UDP
Java server that also lets Bedrock players in (for example with Geyser)25565 and 19132TCP and UDP

These are the defaults. If you changed server-port in server.properties, forward that port instead. Newer Bedrock Dedicated Server versions also have a transport setting; if you changed it, check the comments in server.properties for the ports it uses.

Before you start

  • The server works locally. Join it from the same computer with the address localhost before touching the router. If that fails, fix the server first.
  • You can log in to your router. You need its admin password, which is often printed on a sticker on the router, or your internet provider's app.
  • The server computer stays on. Players can only join while it is running.

Find your computer's local IP address

The router needs to know which device on your network runs the server. That device's local IP address usually starts with 192.168. or 10.

  • Windows: open Command Prompt, run ipconfig, and note the IPv4 Address of your active adapter. The Default Gateway on the same list is your router's address.
  • macOS: open System Settings, choose Wi-Fi or Network, select your connection and open Details. Or run ipconfig getifaddr en0 in Terminal.
  • Linux: run ip addr or hostname -I.

Add the port forwarding rule on your router

  1. Open your router's settings

    Type the Default Gateway address, often 192.168.0.1 or 192.168.1.1, into a browser and sign in. Some providers only offer port forwarding in their app.

  2. Find port forwarding

    It may be called Port Forwarding, Virtual Server, NAT, Port Mapping or Applications & Gaming, often under an Advanced menu.

  3. Create the rule

    Name it Minecraft. Enter your computer's local IP. Set the external and internal port to 25565 with protocol TCP for Java, or 19132 with protocol UDP for Bedrock. If both editions join, add both rules.

  4. Save and apply

    Save the rule. Some routers apply it straight away; others need a restart.

Allow the server through your firewall

Your router can forward traffic correctly and your computer's firewall can still block it.

  • Windows: the first time the server starts, Windows asks whether Java (or bedrock_server.exe) may use the network. Allow it for the network type your computer is on. If you dismissed that, add an inbound rule in Windows Defender Firewall with Advanced Security for the port and protocol above.
  • macOS: in System Settings, under Network, open Firewall and allow incoming connections for Java.
  • Linux with ufw: run sudo ufw allow 25565/tcp for Java or sudo ufw allow 19132/udp for Bedrock.

Test that friends can connect

  1. Find your public IP

    Search "what is my IP" on the server computer. This is the address friends use. For Java they enter just the IP; for Bedrock they enter the IP and port 19132.

  2. Test from outside your network

    Enter your public IP in our Minecraft server status checker. It connects from our servers, outside your home, and works for both Java and Bedrock. You can also turn off Wi-Fi on a phone and join over mobile data, or ask a friend to try.

  3. Join from home using the local address

    On the server computer, keep using localhost. Other devices at home should use the local IP. Many routers cannot connect to their own public IP from inside, so that failing from home does not mean the forward is broken.

Minecraft port forwarding not working?

Carrier-grade NAT (CGNAT)

Many internet providers, especially mobile, satellite and some fibre providers, share one public IP between many homes. Compare the WAN or internet IP on your router's status page with the IP a "what is my IP" search shows. If they differ, or the router's WAN IP starts with 100.64 to 100.127, you are behind CGNAT and port forwarding cannot work. Ask your provider for a public IP address (sometimes paid), or use one of the options further down.

Two routers (double NAT)

If your provider's modem is also a router and you have your own router behind it, traffic has to be forwarded twice. Put the provider's modem in bridge mode, or forward the port on both, pointing the first at the second router.

The rule points at the wrong device

Check the local IP in the rule still matches your computer, especially after a restart. A DHCP reservation stops this happening again.

Wrong protocol or port

Java needs TCP and Bedrock needs UDP. If you run the server on a custom server-port, the rule must use that number and friends must add it to the address, like 203.0.113.7:25570.

server-ip is filled in

Leave server-ip blank in server.properties so the server listens on every network address. A wrong value there stops outside connections.

Your provider blocks the port

A few providers block incoming connections on some ports. Try a different external port, such as 25566, forwarded to the same internal port, and give friends that port.

Your public IP keeps changing

Most home connections get a new public IP now and then. A dynamic DNS service gives you a hostname that follows your IP, so friends do not need a new address each time.

If friends reach the server but see a sign-in error such as "Failed to verify username", the connection is fine: the server could not reach Mojang to check their account. See the Minecraft authentication server status.

How to host without port forwarding

If you cannot change your router settings, or you are behind CGNAT, you still have options:

  • A tunnel service such as playit.gg gives your server a public address and relays traffic to your computer, with no router changes.
  • A private network app puts you and your friends on one virtual network, so they join with a private address. Everyone installs the app.
  • A server host runs the server in a data centre, so your home network is not involved at all.
  • Realms is Mojang's own paid hosting for small groups of friends.

Only install tunnel or network software you trust, since it carries traffic to and from your computer.

Keep your server safe once it is open

  • Turn on the whitelist so only people you add can join. Our Minecraft server whitelist guide shows how, and the server commands list covers kicking and banning.
  • Keep `online-mode=true` so every player has to sign in with a real account.
  • Only forward the Minecraft port. Never forward remote desktop or file sharing ports alongside it.
  • Keep the server software updated and back up the world regularly.
  • Remember your IP is visible to anyone you share the address with. If you plan to list the server publicly, a host or tunnel keeps your home IP private.

Minecraft port forwarding questions

What port does a Minecraft server use?

Java Edition uses TCP port 25565 by default. Bedrock Dedicated Server uses UDP port 19132 for IPv4 and 19133 for IPv6. The port can be changed with server-port in server.properties.

Is Minecraft port 25565 TCP or UDP?

Java Edition servers use TCP on port 25565. UDP is only needed for Bedrock (19132) or if you turn on the optional query feature.

Do I need to port forward to play with friends?

Only when you host the server on your own computer and friends join from outside your home. Players on the same Wi-Fi can join with your local IP, and hosted servers, tunnels and Realms need no port forwarding.

Is port forwarding a Minecraft server safe?

Forwarding only the Minecraft port is reasonably safe if you keep the server updated, keep online-mode on and use a whitelist. It does expose your home IP to anyone who has the address.

How do I know if I am behind CGNAT?

Compare the WAN IP on your router's status page with the IP shown by a "what is my IP" search. If they are different, or the WAN IP starts with 100.64 to 100.127, your provider uses carrier-grade NAT and port forwarding will not work.

Can I port forward without access to my router?

No. Port forwarding is a router setting. Without router access, use a tunnel service, a private network app, a server host or Realms instead.