Java 26.2
/rotate
@s/rotate
Set entity rotation or face a target.
/rotate @s ~ ~
Rotation and facing
The /rotate command turns an entity without moving it, and the facing forms are what make it useful: face a block position, or face another entity anchored at its feet or eyes. Set yaw and pitch by hand, or build a facing form here and skip the trigonometry.
/rotate <target> facing <x> <y> <z> turns it toward that position in place. Unlike /tp with a facing argument, /rotate changes only orientation, leaving the location untouched.
Yaw is the horizontal turn (0 is south, -90 is east) and pitch is the vertical tilt (-90 looks straight up, 90 straight down). You can set exact values or use ~ for relative turns.
/rotate <target> facing entity <player> with a feet or eyes anchor turns it to track that entity, which is handy for aiming display entities and armor stands.
Java 26.2
@sSet entity rotation or face a target.
/rotate @s ~ ~