Discord

Minecraft /setblock and /fill command generator

Place blocks and fill regions in Minecraft with the /setblock and /fill commands. Search more than 300 blocks, set block states (direction, half, shape, waterlogging and dozens more), choose a position and a mode, and the generator builds a ready command to copy. Switch between /setblock (a single block) and /fill (filling a region) with one click.

1Choose a block

2Position

Use ~ for a relative position (e.g. ~5 = 5 blocks from the player). Leave ~ for the player's exact position.

3Mode

✓Generated command

Choose a block above to generate the /setblock command.

How does the /setblock command work?

The /setblock command places a single block at the given position in the Minecraft world. It is one of the most commonly used commands for building, making adventure maps and testing mechanics. Unlike placing blocks by hand, /setblock lets you put any block anywhere, even one you cannot normally get in survival (like a barrier, a light, a command block or a spawner).

The full syntax is: /setblock <x> <y> <z> <block>[states] [mode]. For example, /setblock ~ ~1 ~ minecraft:diamond_block places a diamond block one block above the player's position.

The command requires operator permissions (op level 2+) on a server, or cheats enabled in a singleplayer world. In command blocks and data pack functions, /setblock works without restrictions.

Absolute and relative positions

Minecraft supports three types of coordinates in commands:

  • Absolute (for example 100 64 -200) - exact coordinates in the world. Check your coordinates with the F3 key.
  • Relative with a tilde ~ (for example ~ ~1 ~) - relative to the player's position. ~ = the player's position, ~5 = 5 blocks further along that axis, ~-3 = 3 blocks the other way.
  • Relative with a caret ^ (for example ^ ^1 ^5) - relative to the direction the player is looking. In ^ ^1 ^5 the first value moves left/right, the second up/down and the third forward/backward. Handy for placing blocks "in front of you".

Our generator supports absolute coordinates and relative coordinates with a tilde. Type ~ for the player's position or a specific number (for example 100) for an absolute position. You can also mix types: 100 ~ ~5 sets X to 100, Y to the player's position and Z to 5 blocks from the player.

Block states: the key to precision

Block states are properties that define a specific variant of a block. In Minecraft Java Edition 1.13+, states go in square brackets after the block ID: minecraft:oak_stairs[facing=south,half=top,shape=straight].

Not every block has states. Plain stone (minecraft:stone) has none: it always looks the same. Stairs, on the other hand, have 4 states (direction, half, shape, waterlogging), doors have 5 and so does redstone wire. Our generator automatically shows the available states once you pick a block.

The most common state types:

  • facing (direction) - north, south, east, west (four sides) or additionally up/down (six sides). Sets which way the block "faces".
  • half - top/bottom for stairs and trapdoors. Sets whether the block sits in the upper or lower half of its space.
  • shape - straight, inner_left, inner_right, outer_left, outer_right. These values are for stairs and define the shape of a corner.
  • waterlogged - true/false. Whether the block contains water (for example stairs, slabs and fences submerged in water).
  • axis - x/y/z. The orientation of cylindrical blocks like logs, pillars and bone blocks.
  • powered - true/false. Whether the block is powered by a redstone signal.
  • lit - true/false. Whether a furnace or a redstone lamp is active.
  • open - true/false. Whether a door, trapdoor or fence gate is open.
  • type - depends on the block. For slabs: top/bottom/double. For chests: single/left/right.
  • level - a numeric value. For water and lava: 0-15 (flow level). For a composter: 0-8.
  • age - the growth stage of crops. For example wheat: 0 (just planted) to 7 (ready to harvest).

The generator shows only the states you changed to a non-default value, which keeps the command as short as possible. If you do not change any state, the block appears with its default values, exactly as if no states were given in the command.

/setblock modes: replace, destroy, keep

The /setblock command supports three placement modes:

  • replace (default) - replaces the existing block with the new one. The old block disappears with no effects and no drop. The fastest mode, ideal for building.
  • destroy - destroys the existing block with a particle effect (dust) and an item drop (just like mining it). Then it places the new block. Useful when you want to keep the old block's drop.
  • keep - places the block only when the position is empty (air). If a solid block is already there, the command does nothing. Ideal for filling holes without overwriting an existing build.

If you do not give a mode, replace is used by default. In practice you use replace in about 90% of cases, keep to safely fill in terrain and destroy when you need the drop (for example to take down a build and recover the materials).

The /fill command: filling regions

The /fill command extends /setblock to a rectangular region. Instead of one block, it fills a whole cuboid from point A to point B with the chosen block. Syntax: /fill <x1> <y1> <z1> <x2> <y2> <z2> <block>[states] [mode].

For example, /fill ~ ~ ~ ~10 ~5 ~10 minecraft:stone fills an 11x6x11 region with stone, starting at the player's position. And /fill ~ ~ ~ ~10 ~5 ~10 minecraft:air clears (deletes) all blocks in that region.

Limit: a single /fill can fill at most 32,768 blocks (in Java Edition). That is a region of about 32x32x32. For larger regions you have to split the operation into several commands.

Additional /fill modes

Besides replace, destroy and keep, the /fill command has two additional modes:

  • hollow - builds walls from the chosen block (1 block thick) and fills the interior with air. Ideal for quickly building empty buildings, rooms and chambers.
  • outline - builds walls from the chosen block but leaves the interior unchanged. Ideal for wrapping existing spaces in a frame of blocks without destroying their contents.

The difference between hollow and outline: hollow turns the interior into air (clears everything inside), while outline leaves the interior as it is. If you are building an empty room from scratch, use hollow. If you are adding walls to an existing build, use outline.

Practical uses of /setblock and /fill

Quick foundations

To put up a house, start with a foundation: /fill ~0 ~-1 ~0 ~15 ~-1 ~15 minecraft:stone_bricks places a flat 16x16 platform of stone bricks under your feet. Then the walls: /fill ~0 ~0 ~0 ~15 ~4 ~15 minecraft:oak_planks hollow creates a hollow wooden shell 5 blocks high.

Clearing terrain

Filling a large region around the player with minecraft:air clears it. It is faster than digging by hand and ideal on creative servers and when building an arena.

Making a water pool

First dig a pit: /fill ~1 ~-3 ~1 ~10 ~-1 ~10 minecraft:air. Then flood it with water: /fill ~1 ~-1 ~1 ~10 ~-1 ~10 minecraft:water. The water on the top layer flows down on its own.

Stairs and architecture

With the block state editor you can precisely set the direction of stairs, the orientation of logs, whether a door is open and dozens of other properties. For example, /setblock ~ ~ ~ minecraft:oak_stairs[facing=south,half=top] places oak stairs facing south, upside down.

Redstone and mechanical blocks

Precise orientation of pistons, observers and dispensers is key in redstone circuits. /setblock ~ ~ ~ minecraft:piston[facing=up,extended=false] places a piston facing up. Without a state editor you often have to break and place a block over and over to get the right direction.

Mapmaking and command blocks

On adventure maps, /setblock and /fill in command blocks let you change the surroundings dynamically: opening secret passages (turning a wall into air), setting traps (a spawner, TNT), creating visual effects (magma, fire, lava) and much more. Combine them with /execute and a scoreboard to trigger changes based on player actions.

Special blocks worth knowing

  • barrier - an invisible, unbreakable block. Visible only when you hold it in your hand (particles). Ideal for fencing off an arena.
  • light - an invisible block that emits light (level 0-15). Lets you light a space without a visible light source.
  • structure_void - a block that is ignored when structures load. Used in structure blocks.
  • spawner - placed with a command it is empty (no mob). It needs NBT editing to configure.
  • command_block - comes in three variants: impulse (orange), chain (green), repeating (purple).
  • bedrock - normally unbreakable, but /setblock can replace it.
  • air - setting air effectively removes the block. /setblock ~ ~-1 ~ minecraft:air destroy destroys the block under the player and drops its items.

Differences between Java Edition and Bedrock Edition

Our generator produces commands in Java Edition 1.13+ syntax (the so-called Flattening). The main differences:

  • Block states: Java uses text names ([facing=north]). Bedrock uses a similar syntax but does not support all states.
  • Block IDs: Some blocks have different names in Bedrock (for example concrete vs white_concrete in Java).

Optimization and performance

A few tips for using /setblock and /fill on servers:

  • Large /fill operations can cause lag. Split them into smaller parts and spread them over time (for example one /fill per tick in a repeating command block).
  • The destroy mode creates item drop entities and particle effects. Avoid it on large regions.
  • The keep mode can be faster than replace, because it skips blocks that do not need to change.
  • Avoid placing blocks that need constant updates (like leaves with persistent=false) at large scale.
  • In data packs, use /fill in functions called by /schedule to spread the load over time.

Frequently asked questions

How does the /setblock command work in Minecraft?

The /setblock command places a single block at the given position. Syntax: /setblock <x> <y> <z> <block>[states] [mode]. For example, /setblock ~ ~ ~ minecraft:diamond_block replace places a diamond block at the player's position, replacing the existing block.

What are block states in Minecraft?

Block states are properties that define a block's variant: facing (direction), half (top or bottom), shape, waterlogged (whether the block holds water) and so on. For example, stairs have the states facing=north, half=bottom, shape=straight. States go in square brackets after the block ID: minecraft:oak_stairs[facing=south,half=top].

What is the difference between /setblock and /fill?

/setblock places one block at one position. /fill fills a rectangular region (from position 1 to position 2) with the chosen block. /fill has additional modes: hollow (walls of the block, air inside) and outline (walls of the block, interior unchanged).

What does ~ mean in Minecraft coordinates?

The tilde (~) means a position relative to the player. ~ on its own is the player's exact position, ~5 is 5 blocks from the player along that axis, ~-3 is 3 blocks in the opposite direction. For example, /setblock ~0 ~-1 ~0 minecraft:stone places stone under the player's feet.

What are the /setblock modes?

Three modes: replace (the default, replaces the existing block), destroy (destroys the block with a particle effect and item drops), keep (places the block only if the position is empty, meaning air).

How many blocks can you fill with /fill?

The /fill command can fill at most 32,768 blocks (32x32x32) in a single call in Java Edition. If you try to fill a larger region, the command fails with an error. The fix is to split the operation into several smaller commands.

How do I use /fill hollow and outline?

Hollow mode builds walls from the chosen block and fills the interior with air, which is ideal for making empty buildings. Outline mode builds the walls but leaves the interior unchanged, which is ideal for wrapping existing structures. Both work on a cuboid-shaped region.

Do /setblock and /fill work in Bedrock Edition?

Yes, both commands work in Bedrock Edition, but the block state syntax differs. Bedrock uses a numeric format instead of text for some states and does not support all the states available in Java Edition. Our generator produces Java Edition 1.13+ syntax.