Basic syntax
/fill <from> <to> <block> keep
/fill <from> <to> <block> [replace <filter>] [strict|destroy|hollow|outline]
This syntax applies to Java 1.21.5 and later. Arguments in <…> are required, and arguments in […] are optional. With no mode, the command replaces blocks in the region.
| Argument | Meaning |
|---|---|
from / to | Two opposite corners written as x y z. The blocks at both endpoints are included. |
block | The block ID to place. You can include states, as in minecraft:oak_log[axis=x]. |
filter | Limits replace to a block ID, state, or block tag. For example, minecraft:dirt replaces only dirt. |
Examples
Make a 5×5 stone floor one block below you
/fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 minecraft:stone
Replace only dirt with grass blocks
/fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 minecraft:grass_block replace minecraft:dirt
Build a glass shell while preserving the interior
/fill ~2 ~ ~2 ~6 ~4 ~6 minecraft:glass outline
Placement modes
| Argument | Meaning |
|---|---|
replace | Replaces blocks in the region. A filter limits the change to matching blocks. |
keep | Fills only positions occupied by air. |
destroy | Breaks existing blocks before placing the new blocks. |
outline | Places the shell and preserves blocks inside. |
hollow | Places the shell and clears the interior to air. |
strict | Java 1.21.5 and later. Places blocks without triggering block or shape updates. |
Troubleshooting
If the region is too large, move the corners closer or split the job into smaller regions. Check that the target chunks are loaded.
Combining replace <filter> with another mode such as outline requires Java 1.21.5 or later. Select your version in the generator for older releases.