Updated:

The basic form

WeatherCommand
Clear/weather clear
Rain (snow in cold places)/weather rain
Thunderstorm/weather thunder

The same on Java and Bedrock. Rain does not fall in dry biomes such as deserts, and turns to snow in cold biomes and at high altitude.

You can add a duration after the weather type to choose how long it lasts. Without one, the weather lasts a natural amount of time and then changes again.

EditionRain for 10 minutesUnits
Java 1.19.4+/weather rain 600sAdd s (seconds), d (days) or t (ticks). No suffix means ticks
Bedrock/weather rain 12000Ticks (20 ticks = 1 second)

On Java, /weather rain 600 lasts 600 ticks (30 seconds), not 600 seconds. Older guides that count in seconds give weather that ends almost at once.

Keep it clear

/weather clear alone wears off and rain comes back. Clear the weather, then stop the cycle:

VersionCommand
Java 1.21.11 and later/gamerule minecraft:advance_weather false
Java 1.21.10 and earlier/gamerule doWeatherCycle false
Bedrock/gamerule doweathercycle false

Use true to undo. /weather still works while the cycle is stopped.

Lightning where you want it

A thunderstorm decides where lightning strikes. To strike a specific spot, summon it:

/summon minecraft:lightning_bolt ~ ~ ~5

Lightning starts fires and changes mobs (villagers become witches, pigs become zombified piglins), so test away from your builds.

What weather changes

WeatherMain effects
RainFish bite sooner. Fires under the open sky go out, and so do burning mobs and players. Cauldrons slowly fill with water. Riptide tridents work out of water.
Snow (rain in cold places)Snow layers build up and water can freeze.
ThunderstormDark enough for hostile mobs to spawn outside in daytime. Lightning charges creepers and turns pigs into zombified piglins and villagers into witches. Channeling tridents work. Skeleton horse traps can appear.

For lightning effects in tests or minigames, summoning lightning (above) lets you choose the spot.

Common problems

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.