Updated:
The basic command
/summon minecraft:lightning_bolt ~ ~ ~5
This strikes five blocks south of you. ~ ~ ~ would hit you directly.
Strike players or mobs
/execute at @p[name=!YourName] run summon minecraft:lightning_bolt ~ ~ ~
/execute at @e[type=minecraft:zombie,distance=..10] run summon minecraft:lightning_bolt ~ ~ ~
execute at moves the position to the target first. The first line strikes the nearest other player, the second every zombie within 10 blocks.
Strike where you are looking
/execute at @s run summon minecraft:lightning_bolt ^ ^ ^10
^ uses the direction you face, so this hits 10 blocks ahead. See ~ and ^ coordinates.
What lightning changes
| Struck | Becomes |
|---|---|
| Creeper | Charged creeper (bigger explosion) |
| Pig | Zombified piglin |
| Villager | Witch |
| Mooshroom | Switches between red and brown |
| Nearby blocks | May catch fire |
To avoid fires near builds on Java 1.21.10 and earlier, run /gamerule doFireTick false. The fire rule was renamed in 1.21.11, so pick it from the /gamerule suggestions there.
Repeated strikes
A repeating command block strikes 20 times a second and lags badly. For a show, trigger an impulse block with a button or chain a few blocks.
Thunderstorms and Channeling
/weather thunder starts a storm with natural lightning. A trident with Channeling, thrown during a storm, calls lightning on the target: /give @p minecraft:trident[enchantments={channeling:1,loyalty:3}] (Java 1.21.5+).
Common questions
- No charged creeper: the bolt must hit the creeper; use
execute at @e[type=minecraft:creeper,limit=1,sort=nearest]. - Avoid damage: Fire Resistance stops the burning, but not the strike itself; strike a few blocks away.
- Bedrock: write
/summon lightning_bolt ~ ~ ~5.
Check your command
The Command Error Doctor checks common syntax mistakes in your browser.