How to edit level.dat in Minecraft Java Edition

What level.dat contains in each Java version, which values are safe to change, and how to edit it without corrupting your world.

Every Java world has a level.dat file at the top of its folder. It holds the settings that apply to the whole world: its name, the default game mode, hardcore, whether cheats are allowed, the difficulty and the spawn point. The game reads it when the world loads and writes it again every time the world saves.

What else lives in the file depends on your version. Up to 1.21.11 it also held the game rules, the seed and, in singleplayer, your whole player. Java 26.1 moved those out into separate files. This guide covers both layouts, so check your version before changing anything.

Before you start

  • Close Minecraft, or stop the server. A running game keeps the world in memory and overwrites level.dat when it saves, so your edit would be lost.
  • Copy the whole world folder somewhere safe. Minecraft keeps the previous version as level.dat_old, but that copy changes every time the world saves.
  • Find the folder: in the game, select the world, click Edit, then Open World Folder. The save locations guide lists the paths for each system.

Which layout does your world use?

Open level.dat in the editor and expand Data then Version. The StrName tag shows the version that last saved the world, and IDataVersion gives the same information as a number. The 1.21.11 file used for the first figure has a DataVersion of 4671.

Setting1.21.10 and older1.21.1126.1 and later
Game rulesGameRules, text valuesgame_rules, Byte and Int valuesdata/minecraft/game_rules.dat
SeedWorldGenSettings › seedWorldGenSettings › seeddata/minecraft/world_gen_settings.dat
DifficultyDifficulty (Byte 0–3)Difficulty (Byte 0–3)difficulty_settings › difficulty (text)
Hardcorehardcorehardcoredifficulty_settings › hardcore
Singleplayer playerPlayer compoundPlayer compoundplayers/data/<uuid>.dat, named by singleplayer_uuid
Weatherraining, rainTime…raining, rainTime…data/minecraft/weather.dat

The world spawn also changed shape. Recent versions store it as a spawn compound with a position, a dimension and a rotation, because the spawn can now be in any dimension. Older worlds use separate SpawnX, SpawnY and SpawnZ Ints.

Main tags of a 1.21.11 level.dat (real file, shortened)
  • { }Data
    • BallowCommands0
    • IDataVersion4671
    • BDifficulty1
    • BDifficultyLocked0
    • IGameType0
    • Bhardcore0
    • LLastPlayed1771697593815
    • StrLevelName"world"
    • { }game_rules
      • Bminecraft:keep_inventory0
      • Iminecraft:random_tick_speed3
    • { }spawn
      • Strdimension"minecraft:overworld"
      • I[ ]pos[0, 102, 0]
      • Fyaw0
      • Fpitch0
    • { }Version
      • StrName"1.21.11"
    • { }WorldGenSettings
      • Lseed6508918960062323141
The same settings in 26.x (other tags omitted)
  • { }Data
    • BallowCommands0
    • { }difficulty_settings
      • Strdifficulty"normal"
      • Bhardcore0
      • Blocked0
    • IGameType0
    • StrLevelName"world"
    • I[ ]singleplayer_uuid[1172812361, -1416740125, -1823497584, 1309571129]
    • { }spawn

The edits people make most

GoalTagValues
Allow commands (cheats)BallowCommands1 on, 0 off. Details
Turn hardcore offBhardcore0 off, 1 on. Details
Change difficulty (up to 1.21.11)BDifficulty0 peaceful, 1 easy, 2 normal, 3 hard
Change difficulty (26.x)Strdifficultypeaceful, easy, normal or hard
Unlock a locked difficultyBDifficultyLocked or Blocked0 unlocked
Default game modeIGameType0 survival, 1 creative, 2 adventure, 3 spectator
Name in the world listStrLevelNameAny text. The folder name doesn't change.
Move the world spawnI[ ]pos inside spawnThree numbers: X, Y, Z

Step by step

  1. Close Minecraft and back up the world folder.
  2. Open the editor and drop level.dat onto it. The bar above the tree should read Java (big-endian) and gzip.
  3. Expand Data and click the value you want to change. Type the new value and press Enter. The badge in front of each name tells you its type: keep Bytes as Bytes, Ints as Ints.
  4. Click Download. The file is saved as level.dat with the original compression.
  5. Replace the level.dat in your world folder with the downloaded one. If your browser added a number to the name, such as level (1).dat, rename it back to level.dat.
  6. Start Minecraft, open the world and check that the change took effect.

Tags to leave alone

  • DataVersion and Version. The game uses them to decide how to upgrade old data. Lowering them does not downgrade a world; it makes the game misread it.
  • WorldGenSettings › dimensions. This describes the world generator for each dimension. A mistake here stops the world from loading.
  • The seed. Changing it is possible, but only chunks generated afterwards use the new seed, so you get sharp cliffs where old and new terrain meet.
  • DataPacks. Use the in-game data pack screen. Editing the list by hand can enable packs the world isn't ready for.

If something goes wrong

The change disappeared. The game was still running and saved over it. Close it completely and edit again.

The world won't load or is missing from the list. Put your backup back. If you have no backup, rename level.dat_old to level.dat: it is the previous save. The corrupted level.dat guide covers the rest.

The editor says a value is out of range. Each type has limits: a Byte holds −128 to 127, for example. Use a value in range, or change the type from the row's ☰ menu if you really need a bigger number.

Ready to edit?Open the file in the editor: every value keeps its NBT type and the file is saved in its original format.