/testfor Command in Minecraft Bedrock Edition

Count Players and Entities with Testfor

Bedrock EditionLogic & ScoreboardPermission: Game DirectorsCheats: Yes

The /testfor command counts entities like players, mobs, and items that match specific conditions you set. It tells you if a certain target exists in your loaded world right now.

Players and map makers use this command to check if someone is online, count how many monsters are in an arena, or detect dropped items. To use it, you must have cheats enabled and hold Game Directors permissions.

Syntax (1 form)

  1. /testfor <victim: target>

    Test for

Arguments

ArgumentTypeWhat it means
victimtargetA name `string` or `target selector` to identify who or what is being counted.

Examples

Tips

Common mistakes

Bedrock vs Java

Minecraft Java Edition does not have a command named /testfor, as it is only available in Bedrock Edition.

FAQ

What does the /testfor command do in Minecraft?

It counts players, mobs, items, and other entities in the world that match the name or target selector you enter.

Why can I not use the /testfor command?

This command requires cheats to be enabled in your world and you must have the Game Directors permission level to run it.

Is /testfor available in Minecraft Java Edition?

No, Java Edition has no command with this name; it is only used in Bedrock Edition.

Related commands

/dialogue/execute/function/packstack/reload/reloadpacketlimitconfig/schedule/scoreboard/scriptevent/sendshowstoreoffer/tag/testforblock/testforblocks/toggledownfall