Updated:
Basic form
/fill <from> <to> <block> [mode]
/fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 minecraft:stone
This makes a 5×5 stone floor one block below you. Start this small until you are sure which way the coordinates point.
Count the blocks first
Both corners are included. From X 0–4, Y 64–66 and Z 0–2 the box is (4−0+1)×(66−64+1)×(2−0+1) = 45 blocks. A quick count shows whether the box is the size you expect.
Modes
| Mode | What it does |
|---|---|
replace (default) | Replaces everything in the box |
destroy | Breaks existing blocks as if mined, dropping items |
keep | Only fills air |
hollow | Builds the outer shell and fills the inside with air |
outline | Builds the outer shell and leaves the inside as it was |
Use hollow for a room, outline to wrap something that already exists.
Examples
# A wall 5 blocks east, 5 high and 11 long
/fill ~5 ~ ~-5 ~5 ~4 ~5 minecraft:stone_bricks
# Carve out a small room
/fill ~-3 ~ ~-3 ~3 ~3 ~3 minecraft:air
# Turn only dirt into grass on the floor
/fill ~-5 ~-1 ~-5 ~5 ~-1 ~5 minecraft:grass_block replace minecraft:dirt
Keeping one coordinate the same on both corners gives a flat wall or floor. A block after replace limits the change to that block only.
The size limit
One /fill changes at most 32,768 blocks (32×32×32). Split bigger areas into several commands, and back up the world before large changes.
On Java Edition 1.20.3 and later, this limit is a gamerule, commandModificationBlockLimit (default 32768). It also applies to /clone and /fillbiome. On a test world you can raise it with /gamerule commandModificationBlockLimit 100000, but huge fills can freeze the server for a while. Newer versions may list the rule under a different name, so use tab completion after /gamerule to find it. Bedrock Edition has no such gamerule, so split the area instead.
When it does not work
- "Too many blocks": the box is over the limit; split it.
- "That position is not loaded": part of the box is too far away. Move closer.
- It filled the wrong direction:
~follows the world axes, not where you face. Check Facing on the F3 screen; see relative and local coordinates. - Water rushed in: clearing with air next to water lets it flow. Block it off first.
Common questions
- Can I undo a fill? No. Back up first, or copy the area elsewhere with /clone.
- Is Bedrock the same? The basic form and the limit match. Block states are written differently, so follow the in-game suggestions.
- Single blocks? Use /setblock.
The fill generator keeps the six coordinates and the mode in separate fields so they are easier to check.
Check your command
The Command Error Doctor checks common syntax mistakes in your browser.