Java and Bedrock selector syntax

Minecraft Target Selector Generator

Build an accurate @p, @a, @e, @s, @r, @n, or @initiator selector, then paste it into commands such as /kill, /tp, /effect, /tag, and /execute.

Generated target selectorJAVA
@e

Quick /kill presets

Hostile mobs: Java has no family argument. Choose an entity type instead.

Target and identity

Start typing to choose a vanilla entity, or enter a custom namespace ID.

Enter an exact in-world name. Names containing spaces are quoted automatically.

Enter a scoreboard tag that your command or datapack already assigns.

Distance and experience

Leave either side empty for an open range. Distance is measured in blocks from the selector origin.

Position and advanced filters

Origin and selection box

Rotation range

Results and scores

Score objective names are custom data from your world. The objective must already exist.

Java uses distance, level, limit, sort, x_rotation, and y_rotation. @n selects the nearest entity in current Java versions.

How Minecraft target selectors work

A target selector is an argument, not a command by itself. It starts with a base such as @p for the nearest player or @e for entities, followed by optional filters inside square brackets. Paste the finished selector wherever a compatible command expects a player or entity target.

Java and Bedrock share the familiar @p, @a, @r, @s, and @e bases, but their filter names are not interchangeable. This generator changes the parameter names and available controls when you switch editions, so it does not produce Java distance or sort arguments inside a Bedrock command.

Choose the correct base

@p finds the nearest player, @a all players, @r a random player, @s the command executor, and @e all entities. Java also has @n for the nearest entity, while Bedrock has @initiator for the player who opened NPC dialogue.

Combine precise filters

Narrow results by entity type, name, tag, game mode, distance, experience level, coordinates, a cuboid volume, facing rotation, scoreboard values, and edition-specific advanced data.

Control the result set

Java uses limit with sort=nearest, furthest, random, or arbitrary. Bedrock uses c to cap the number of targets selected according to the base selector ordering.

Keep technical values unchanged

Selector keys, entity IDs, objective names, tags, namespaces, and command tokens are game data. Enter them exactly as they exist in your world, datapack, behavior pack, or scoreboard.

How do I kill all dropped items?

Use /kill @e[type=item] in both Java and Bedrock. Avoid /kill @e[type=!player] for item cleanup: in Java it also removes armor stands, item frames, paintings, minecarts, boats and tamed pets.

Check who matches before running the command

Build the smallest useful selection first. Choose the base, add the entity type, then add range or tags. Combining many filters immediately makes an empty result hard to explain. Filters narrow the selection together; adding a tag does not create an alternative to the type filter. Keep tag spelling and scoreboard objective names exactly as they appear in the world.

Range is measured from the execution position. A command block, a player in chat and an execute-at command can therefore select different entities with the same text. Set the execution point deliberately for arena or room checks. A box filter is useful for a rectangular region, while distance describes a radius.

Why does @s select nothing in a command block?

The block is a command source, not an executing entity. Use execute as to establish an entity executor when the next command needs @s.

Why does a command reject a valid selector?

The command may require players only or exactly one result. A selector valid for a group operation is not valid everywhere. In Java use an appropriate limit and sort when one result is required; Bedrock uses its own count argument. Recheck the complete command after choosing the edition.