← All Courses

Minecraft Coding: Command Your World

Free   6 lessons

Lesson 2: The /fill Command — Build Anything Instantly

The /fill Command — Build Anything Instantly

The /fill command is one of the most powerful in Minecraft. It fills a rectangular region with any block you choose — instantly. Building a house that would take 20 minutes by hand takes 3 seconds with /fill.

The Syntax

/fill x1 y1 z1 x2 y2 z2 blockname
  • x1 y1 z1 — coordinates of one corner of the region
  • x2 y2 z2 — coordinates of the opposite corner
  • blockname — the block to fill with

Understanding Coordinates

Press F3 (Java) or enable "Show Coordinates" in settings (Bedrock) to see your position.

  • X — how far East (+) or West (-) you are from world center
  • Y — your height. Sea level is Y=63. Ground is usually Y=64.
  • Z — how far South (+) or North (-) you are

Think of coordinates like a 3D graph. Every block in Minecraft has a unique X Y Z address.

Build a Solid Box

Stand somewhere open. Note your coordinates. Let's say you're at X=100, Y=64, Z=200.

/fill 100 64 200 115 74 215 stone

This fills a 16×11×16 region with stone — a solid stone cube. That's 2,816 blocks placed instantly.

Build a Hollow Structure

Solid boxes are nice but you want to go inside. Add hollow at the end:

/fill 100 64 200 115 74 215 stone hollow

Now only the outer shell is stone. The inside is air. You just built a room.

Clear an Area

Fill with air to remove blocks:

/fill 100 64 200 115 74 215 air

Everything in that region disappears. This is how you clear land fast, remove mistakes, or dig tunnels.

Using Relative Coordinates (~)

The tilde ~ means "relative to my current position." This is incredibly useful because you don't have to figure out exact world coordinates.

/fill ~-5 ~-1 ~-5 ~5 ~5 ~5 glass hollow

This builds a glass box 10×6×10 centered on you, no matter where you are in the world. The ~-5 means "5 blocks in the negative direction from me."

Replace Mode

Only replace a specific block type:

/fill ~-10 ~-1 ~-1 ~10 ~5 ~10 oak_planks replace grass_block

Replaces only grass blocks with oak planks. Leaves everything else alone.

Build a Road

/fill ~-1 ~-1 ~-1 ~1 ~-1 ~50 stone_bricks

A 3-block-wide stone brick road stretching 50 blocks ahead of you.

Practice Challenges

  1. Build a hollow cobblestone house that is 10×6×10
  2. Add a floor inside it using a different block type
  3. Build a glass pyramid (hint: you'll need multiple /fill commands, each layer smaller)
  4. Clear a 20×20 area to flat bedrock level
  5. Build a swimming pool: hollow box, then fill the inside with water