/publish
Opens a singleplayer world to LAN, allowing other players on the local network to join.
Overview
Opens a singleplayer world to LAN, allowing other players on the local network to join. In vanilla Minecraft Java Edition it is one of the special commands and has been available since version 1.3.
It is invoked as /publish [ and accepts 3 optional arguments ([allowCommands], [gamemode], and [port]).
LAN worlds are temporary and only available while the host is online. The port is displayed in chat. Other players on the same network can see the world in their multiplayer list.
The opened LAN world lasts only while the host stays online; the chosen (or random) port is printed in chat and must be reachable through the system firewall.
Syntax & Arguments
/publish [<allowCommands>] [<gamemode>] [<port>]The full syntax is /publish [. Angle brackets < > mark required arguments and square brackets [ ] mark optional ones; a vertical bar | between words means you pick exactly one of those literals. Every argument is optional, so the bare command is valid on its own. The arguments [allowCommands], [gamemode], and [port] may be omitted, in which case the documented default applies.
- allowCommands
- Optional, of type a boolean. Whether to allow cheats for connecting players. Defaults to the current cheat setting.
- gamemode
- Optional, of type a gamemode. The game mode for connecting players.
- port
- Optional, of type an integer. The port to host on. Defaults to a random available port.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| allowCommands | boolean | Optional | Whether to allow cheats for connecting players. Defaults to the current cheat setting. |
| gamemode | gamemode | Optional | The game mode for connecting players. |
| port | integer | Optional | The port to host on. Defaults to a random available port. |
Examples
The 2 examples below are ready to copy and adapt. For instance, /publish opens the world to LAN with current settings on a random port. Each example varies the arguments to show a different real use of /publish; read the note under every snippet to see exactly what changes.
/publishOpens the world to LAN with current settings on a random port.
/publish true survival 25565Opens to LAN with cheats enabled, survival mode, on port 25565.
Permission Level & Requirements
/publish sits at permission Level 4 - Owner / Console, which means it needs permission level 4 (owner or server console).
Requires level 4 and is only meaningful in a single-player world that you are hosting.
This reference describes the Java Edition 1.21 form of the command; Bedrock Edition may use slightly different argument formats.
Common Mistakes
- Expecting the LAN world to persist after closing the game, LAN hosting ends when the host disconnects.
- Firewall blocking LAN connections, ensure the port is not blocked by the system firewall.
Notes
LAN worlds are temporary and only available while the host is online. The port is displayed in chat. Other players on the same network can see the world in their multiplayer list.
Related Commands
If /publish is part of your toolkit, the commands below are the ones you will most often reach for alongside it: /gamemode and /op. They cover closely related tasks, so the links above jump straight to each one.
Frequently Asked Questions about /publish
What does the /publish command do in Minecraft?
Opens a singleplayer world to LAN, allowing other players on the local network to join. It belongs to the special command group and was added in Java Edition 1.3.
What is the correct syntax for /publish?
/publish [
What permission level does /publish need?
It requires permission Level 4 - Owner / Console. On a server the player must be an operator at that level, or have cheats enabled in single-player.
What is a common mistake when using /publish?
Expecting the LAN world to persist after closing the game, LAN hosting ends when the host disconnects.
Can you give an example of /publish in use?
Yes. /publish true survival 25565 — opens to LAN with cheats enabled, survival mode, on port 25565.
Need a Minecraft server?
Try these commands on Astroworld or host your own server.
Try Astroworld Hosting