Short answer: On PC, add -console to Valheim’s launch options in Steam (or tick Enable Console in the gameplay settings), load a world and press F5. Type devcommands to turn cheats on; since 1.0 the game asks you to confirm with confirmcheats. Then god makes you invulnerable, fly lets you fly, spawn [item] [amount] spawns items and exploremap reveals the map. Cheats work in single player or as the host only.
How to turn on the console
Steam: right-click Valheim in your library, choose Properties and type -console under Launch Options.
PC Game Pass / Microsoft Store: make a shortcut to Valheim.exe and add -console to the end of the Target field.
In game (recent versions): press Esc, open Settings, then Gameplay, and tick Enable Console.
Load your world and press F5 to open the console. Type devcommands and press Enter; confirm with confirmcheats if asked. Type devcommands again to turn cheats off.
Xbox: the console exists there too: hold LB+RB+LT+RT, press Menu, then A to bring up the keyboard. The console is also available on PS5. On dedicated servers, cheats are blocked unless the server is modded.
Achievements: sources disagree on whether cheats block them. Since 1.0, some guides say using a cheat after confirmcheats stops achievement progress for that character and world. Use a separate character and world if achievements matter to you.
Commands that work without cheats
Command
What it does
help
Lists the commands.
save
Saves the world straight away.
ping
Shows your latency to the server.
lodbias [1-5]
Sets the draw distance.
info
Shows system information.
kick [name/IP/userID]
Kicks a player from your server.
ban [name/IP/userID]
Bans a player.
unban [IP/userID]
Lifts a ban.
banned
Lists banned players.
nomap
Turns the map on or off for the world.
noportals
Turns portal use on or off.
Valheim
Character cheats
Command
What it does
god
God mode: you take no damage. Type it again to turn it off.
ghost
Enemies ignore you.
heal
Fills your health.
puke
Clears your food and resets health and stamina.
raiseskill [skill] [amount]
Raises a skill, for example raiseskill swords 100.
resetskill [skill]
Sets a skill back to 0.
resetcharacter
Resets your character.
model 0
Switches to body type 1; model 1 switches to body type 2.
clearstatus
Removes status effects.
dpsdebug
Shows a damage-per-second readout.
Flying, building and debug mode
Command
What it does
fly
Turns flying on or off.
freefly
Detaches the camera for free flight.
ffsmooth 1
Smooths the free camera; ffsmooth 0 turns smoothing off.
nocost
Build and craft without materials.
debugmode
Turns on debug mode and its keys (below).
Key (in debugmode)
What it does
Z
Turns flying on or off. Space flies up, Ctrl flies down.
B
Free building: no workbench and no materials needed.
K
Kills enemies near you.
L
Removes items lying on the ground near you.
Ctrl+F3
Hides the HUD.
Items and creatures
Command
What it does
spawn [item] [amount] [level]
Spawns an item or creature next to you (not in your inventory). Item names are case-sensitive.
tame
Tames creatures around you.
killall
Kills creatures around you, tamed ones included.
killenemies
Kills hostile creatures only.
killtame
Kills tamed creatures only.
removedrops
Removes dropped items near you.
removebirds
Removes birds near you.
removefish
Removes fish near you.
Map and teleporting
Command
What it does
exploremap
Reveals the whole map.
resetmap
Hides the map again.
pos
Shows your coordinates.
goto [x,z]
Teleports you to the coordinates. Some guides write it as goto [x] [z].
recall [player]
Teleports another player to you.
Time, weather and raids
Command
What it does
tod [0-1]
Sets the time of day: 0.5 is midday, 0 or 1 is midnight. tod -1 brings the normal day cycle back.
skiptime [seconds]
Moves time forward.
sleep
Skips ahead one day.
timescale [multiplier]
Speeds up or slows down time (up to 3).
wind [angle] [intensity]
Sets the wind. Angle 0 is north; intensity is 0 to 1.
resetwind
Puts the wind back to normal.
env [weather]
Forces a weather type, for example env Rain.
resetenv
Puts the weather back to normal.
event [name]
Starts a raid event.
stopevent
Stops the current event.
randomevent
Starts a random event.
players [n]
Scales difficulty as if n players were nearby; 0 resets it.
World keys
Command
What it does
listkeys
Lists the world’s global keys (boss and progress flags).
setkey [key]
Adds a global key.
removekey [key]
Removes a global key.
resetkeys
Removes all global keys.
Commands that changed or no longer work
Old command
Status
imacheater
Renamed to devcommands in patch 0.148.6 (March 2021).
removeall
Found only in old lists. Not in current versions.
optterrain
Only converts terrain made before patch 0.150.3. Not needed for new worlds.