Minecraft /publish command
Opens the world you are playing to friends over LAN and tells you the port.
Syntax
/publish
/publish [<allowCommands>] [<port>]
Parts in square brackets are optional, parts in angle brackets are required. You do not type the brackets: Put your own value in their place.
Arguments
| Argument | What it does |
|---|---|
| [<allowCommands>] | true or false: Whether players who join can use commands. |
| [<port>] | The port to use. Leave it out and the game picks a free port. |
Examples
/publish
Opens the world to LAN.
/publish true 25565
Opens the world on port 25565 with commands allowed.
Good to know
- Only works in a singleplayer world; it does not exist on dedicated servers.
- In 26.3 the game mode argument was removed; use /unpublish to close LAN.
- It stays open only until the game closes.
How do I run this command?
Press T in game to open chat (or press / directly), type the command and press Enter. While typing, Tab completes the options. This command counts as a cheat: It needs cheats enabled in a singleplayer world, and operator permission on a server (server owner (level 4)).
Related commands
🛡️ More Server management
Minecraft is a product of Mojang Studios. This tool is an independent helper made for players and is not affiliated with Mojang or Microsoft.