How to Open Port 25565 for Your Minecraft Server (and What to Do About CG-NAT)
If your Minecraft server runs on your PC, your friends can only join if the router lets their connection through to it: that's “opening the port”. It takes four steps (a fixed IP, a rule on the router, the firewall and testing it), and when it fails it's almost always for the same reasons: CG-NAT, two routers or Windows. Here's all of it, in order.
Which port you need to open
Minecraft Java uses port **25565 TCP**. It's the one set by server-port in server.properties: if you changed it, open that one instead. You don't need UDP to play.
UDP only comes in if you use something extra: Bedrock (the Bedrock dedicated server, or Geyser so people can join from phones and consoles) uses 19132 UDP, and the Simple Voice Chat mod or plugin uses 24454 UDP. Each one is another rule on the router.
This guide is for a real server (the server.jar or a Paper server) running on your PC. If you don't have one yet, start with how to make a Minecraft server.
Rather not set it up yourself? Minecraft servers from €6 a month, no contract and a full refund within 72 hours. Or create a free Minecraft server, no card needed.
Step 1: give your PC the same home IP every time
The router hands out the IPs inside your home however it likes, and the port rule points at one of them: if your PC gets a different one tomorrow, the rule points at nothing.
Look up your IP and the router's
On Windows, open “Command Prompt”, type
ipconfigand note two lines for your connection: “IPv4 Address” (your PC's, something like 192.168.1.35) and “Default Gateway” (the router's, almost always 192.168.1.1 or 192.168.0.1).Reserve it on the router
On the router, look for “DHCP”, “Static IP” or “Address Reservation” and assign that IP to your PC. That way it doesn't change even when you restart.
Step 2: the rule on the router
Sign in to the router
Type the gateway into your browser (for example
192.168.1.1). The username and password are usually on the sticker underneath the router. Some ISPs handle this from their app or customer area instead of this page.Find the section
Every brand calls it something different: “Port Forwarding”, “NAT”, “Virtual Servers” or “Port Mapping”. Sometimes it's inside “Advanced” or “Security”.
Create the rule
Protocol TCP, external port 25565, internal port 25565 and, as the destination, your PC's IP from step 1. Give it a name (Minecraft) and save.
If the router asks, restart it
Many apply the rule right away; others not until they restart.
Step 3: the Windows firewall
The first time you start the server, Windows asks whether to let Java use the network. Tick “Private networks” and press “Allow access”. If you closed it or said no, the router lets the connection through and Windows drops it.
To fix it: “Windows Defender Firewall” → “Allow an app or feature through Windows Defender Firewall”, and tick the Java that runs the server (“OpenJDK Platform binary” or “Java(TM) Platform SE binary”). If you have an antivirus with its own firewall, you also have to allow it there.
Step 4: check it can be seen from outside
Test the port from outside
With the server running, open Is my port open? on the same PC or another one at home: it shows your public IP (the one you'll give your friends) and tests 25565 from our machine, the way a friend would connect. It tells you whether it's open, whether the router lets it through but the server doesn't answer, or whether nothing gets through.
Or test it with the IP
If you already know your public IP (search “what is my IP”), you can also type it into Is my Minecraft server online?: if it shows as online, with its version and its MOTD, your friends can already join with that IP (with 25565 you don't need to add the port).
Don't test it from home
Many routers don't let you reach your public IP from inside your own network. If it doesn't work for you, that doesn't mean it's closed: you join with
localhostand leave the test to the tool or a friend.
If it's still closed: CG-NAT
Compare the public IP that “what is my IP” gives you with the one the router shows as “WAN IP” or “Internet IP” on its status page. If they aren't the same, or the router's starts with 100.64 to 100.127, you have CG-NAT: you share the IP with other customers of your ISP and no rule on your router can open anything, because your friend's connection is stopped earlier, at the ISP. Is my port open? does the comparison for you: type in the router's WAN IP and it tells you whether it's CG-NAT or there's another router in front.
It's common on home internet over 4G or 5G and on some fibre connections. In Spain, Digi uses it by default on its fibre and removes it with a separate paid service (check the conditions on its website). With other ISPs it's sometimes enough to call and ask for “a public IP” or to be “taken off CG-NAT”.
If you don't want to or can't, there are workarounds that don't go through the router: a VPN like Radmin or a tunnel like playit.gg (playing with friends without port forwarding), or a server outside your home (below).
Other reasons nobody can join
Two routers
If you have your ISP's router and another one of your own behind it, you have to open the port on both (from the ISP's one to yours, and from yours to the PC), or put the ISP's one in bridge mode.
server-ip filled in
In server.properties,
server-iphas to be empty. With an address that isn't the machine's, the server won't start or won't listen where the connection arrives.The server isn't running
With the console closed there's nothing to answer: the port shows as closed even if the rule is fine. Check in the console that it has reached “Done”.
A different port
If you changed
server-port, the rule has to use that number, and your friends type it after the IP (yourip:25570).Your friends connect but get kicked
Then the port is already open: the problem is something else (version, whitelist, mods). It's covered in I can't connect to my Minecraft server.
What having the port open means
Your home IP is visible to whoever joins, and there are programs that scan the internet looking for open Minecraft servers: if it isn't for everyone, turn on the whitelist (whitelist) and leave online-mode set to true. And the world only exists while your PC is on: if you're not around, nobody plays.
What you notice most is your connection's upload speed and the PC's processor, which it shares with everything else you have open (including your own Minecraft if you play on the same machine).
Without touching the router: a server outside your home
On NapNodes there are no ports to open: every server has its own address (<id>.play.napnodes.com, without a port in Minecraft), it works with your PC switched off and your home IP doesn't show up anywhere. If you want voice chat or a web map, every Minecraft server comes with a second port already open in “Advanced settings” → “Ports”.
To try it, the free server: no card, you start it when you're going to play and it stops by itself when it's empty. If you stick around, you move to a plan with the same world.
Frequently asked questions
Which port do you open for a Minecraft server?
25565 TCP on Java, or whatever server-port says in server.properties if you changed it. Bedrock and Geyser use 19132 UDP.
Do you open the port as TCP or UDP?
For Minecraft Java, TCP is enough. UDP is only needed for Bedrock or Geyser (19132) and for Simple Voice Chat (24454).
Why is the port still closed if I already opened it on the router?
From most to least common: CG-NAT from your ISP, the Windows firewall blocking Java, your PC's IP having changed, two routers in a chain, or the server being off while you test it.
How do I know if I have CG-NAT?
If the Internet IP your router shows isn't the same one you get when you search “what is my IP”, or it starts with 100.64 to 100.127, you have CG-NAT and you can't open ports unless your ISP gives you a public IP.
Can you play with friends without port forwarding?
Yes: with a VPN like Radmin, a tunnel like playit.gg, or a server outside your home, which already has its own address on the internet and doesn't depend on your PC or your router.
Shall we set it up for you?
Minecraft servers from €6 a month, never oversold: your RAM is yours alone. And if you'd rather start without paying, there's a free Minecraft server, no card needed.
Your server doesn't show up in the game? Check it in a second with “Is my Minecraft server online?”: players, version and MOTD, free. Need a player's UUID for the whitelist or permissions? Look it up here. Handing out enchanted items? Build the command with the /give generator.
Free tool: Is my Minecraft server online?. Type a Minecraft server address and see whether it responds, how many are playing, its version and its MOTD.
Free tool: Is my port open?. Check from the internet whether your home server's port is open (Minecraft, Valheim, Zomboid) and whether your ISP uses CG-NAT.
Keep reading
- Play Minecraft with Friends Without Port Forwarding: Hamachi, Radmin VPN, playit.gg and Hosting
Play Minecraft with friends without touching the router: Hamachi, Radmin VPN, tunnels like playit.gg and a rented server. What each does and when to switch.
- How Many Players Can a Minecraft Server Handle?
How many players fit on a Minecraft server depending on RAM, plugins and mods, and how to test it with your own group.
- How to Op Someone on Your Minecraft Server (and Deop Them): Levels and Errors
How to op yourself or a friend on your Minecraft server, what each level allows, the ops.json file and what to do if you get “That player does not exist”.