The /fill command is one of the most powerful building tools in Minecraft, allowing you to instantly generate massive walls, clear out entire caverns, or replace specific blocks across large areas. Whether you are terraforming a landscape or testing new designs in Creative Mode, mastering this command will save you hours of manual block placement in both Java Edition and Bedrock Edition.
Minecraft has a default limit of 32,768 blocks per /fill command in both Java and Bedrock. If your chosen coordinates exceed this volume, the command will fail. Fill large zones in smaller sections to stay under the limit.
In Java Edition, you can look at any block, type /fill in chat, and press Tab three times to automatically insert the exact XYZ coordinates of that targeted block.
Enable Cheats in Your World
To execute the fill command, cheats must be enabled in your world. In Java Edition, press Escape, select Open to LAN, toggle Allow Cheats to ON, and click Start LAN World. In Bedrock Edition, pause the game, go to Settings > Game, scroll down to the Cheats category, and toggle Activate Cheats on.
Determine Your Coordinate Boundaries
The /fill command requires two sets of XYZ coordinates that define the opposite diagonal corners of a 3D box. In Java Edition, press F3 and read the Targeted Block numbers on the right side of the screen while looking at each corner. In Bedrock Edition, enable Show Coordinates in world settings to see your current position in the top-left corner.
You can also use relative coordinates with tildes (~). For example, ~ ~ ~ refers to the block at your feet, while ~5 ~2 ~5 points five blocks forward, two blocks up, and five blocks sideways relative to you.
Run the Basic Fill Command
Press T or your console controller's chat button to open the chat window. Enter the fill command using the format /fill <x1> <y1> <z1> <x2> <y2> <z2> <block>.
For example, typing /fill ~ ~ ~ ~4 ~3 ~4 stone creates a solid cube of stone that is 5 blocks wide, 4 blocks tall, and 5 blocks long starting from your feet. Press Enter to place the blocks instantly.
Choose a Fill Mode for Specialized Structures
By default, /fill creates a solid block mass. You can add a mode at the end of the command to change how it operates:
hollow: Fills only the outer walls, floor, and ceiling with your selected block, turning the entire interior into air.outline: Fills only the exterior shell, leaving whatever was already inside completely untouched.keep: Places blocks only in empty spaces (air), leaving all existing blocks intact.destroy: Overwrites all existing blocks in the area and drops them on the ground as items.
For example, running /fill ~ ~ ~ ~10 ~5 ~10 cobblestone hollow builds an instant empty room.
Filter and Swap Blocks Using Replace
The replace mode lets you target a specific block type within an area without altering anything else. This is ideal for clearing out water pockets, converting dirt fields into stone, or swapping building palettes.
In both Java and Bedrock editions, structure the command as /fill <from> <to> <new_block> replace <target_block>. For example, typing /fill ~-5 ~-2 ~-5 ~5 ~5 ~5 air replace water drains all water within the specified area without breaking surrounding blocks.
Frequently Asked Questions
How do I clear or delete blocks with the fill command?
Set the block type to air. For example, typing /fill ~ ~ ~ ~10 ~10 ~10 air completely clears every block within that volume, leaving an empty space.
Why does the game say 'Cannot place blocks outside of the world'?
This error appears if your coordinates extend outside the world height boundaries (below Y -64 or above Y 320) or if the target area reaches into unloaded chunks beyond your current render distance.
Can I undo a fill command if I make a mistake?
Minecraft does not have an undo command. To avoid accidental destruction of builds, always test coordinates with smaller numbers first or create a world backup before executing massive fills.








