Vivian’s Minecraft ToolsSMALL TOOLS. BIG ADVENTURES.
MINECRAFT JAVA EDITION

How to use fill (Java Edition)

Fill the box between two opposite corners. You can also build just the shell or replace only matching blocks.

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.

ArgumentMeaning
from / toTwo opposite corners written as x y z. The blocks at both endpoints are included.
blockThe block ID to place. You can include states, as in minecraft:oak_log[axis=x].
filterLimits replace to a block ID, state, or block tag. For example, minecraft:dirt replaces only dirt.

Minecraft Java 1.21.5 release notes

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

ArgumentMeaning
replaceReplaces blocks in the region. A filter limits the change to matching blocks.
keepFills only positions occupied by air.
destroyBreaks existing blocks before placing the new blocks.
outlinePlaces the shell and preserves blocks inside.
hollowPlaces the shell and clears the interior to air.
strictJava 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.

Make your own command

Open generator →
Ad space (preview)