Swing your own arm
/swingPlays the swing animation on you, with the main hand.

/swing plays the arm swing animation on living entities, with the main hand or the off hand. Without arguments it applies to you. It gives cutscenes, NPCs and machinima a little life, and it does not deal any damage on its own.
/swing [<targets> [mainhand|offhand]]| Argument | Expects | What it does |
|---|---|---|
| targetsoptional | Entity selectorone or several | Entities that swing: @s, @a or @e[type=minecraft:zombie]. Only living entities react. Defaults to you. |
| animationoptional | Animation | Type of swing animation, checked by the game. An unknown value is rejected with an error. |
| durationoptional | Duration (ticks, or 10s, 2d)at least 1 | Length of the animation, at least one tick, written like 10t, 1s or 1d. |
/swingPlays the swing animation on you, with the main hand.
/swing @e[type=minecraft:zombie,distance=..10] mainhandEvery Zombie within 10 blocks swings its main arm at once.
/swing @s offhandPlays the animation with your off hand instead of the main hand.
Fill in the fields, then copy the command.
Command generatortargets accepts any selector, but only living entities swing; otherwise the game answers "No living entities were found to swing". After the targets, mainhand or offhand picks the arm. Two optional arguments follow: animation, a swing animation type checked by the game ("Unknown swing animation type: x" for a wrong value), and duration, a time of at least one tick, written with t, s or d.
Turn a Villager first with /rotate, then make it swing, or spawn an actor with /summon. To actually hurt something, use /damage.
✓ Checked in Java Edition 26.3 · updated 2 November 2026
No. It only plays the arm animation. Use /damage to deal damage.
The selector only matched entities that cannot swing, such as boats or dropped items. Target players or mobs instead.
Type it in the chat with cheats on: /swing [<targets> [mainhand|offhand]].
Cheats on, or operator level 2.
It is in the official command tree since Java Edition 26.1.