What level.dat does and why you might edit it
level.dat is a single file that stores the core settings for your Minecraft world — things like the game mode, difficulty, whether cheats are on, the world spawn point, and the time of day. When you load a world, Minecraft reads this file first to know how to set everything up. Editing it lets you change those settings without loading the world in-game, which is useful if your world won't load properly, if you want to turn on cheats after the fact, or if you need to move the spawn point.
The file lives in your world folder and is written in a format called NBT (Named Binary Tag) that Minecraft uses internally. You cannot edit it with a text editor like Notepad — you need a tool that understands NBT format. The most straightforward option is an NBT editor, a small program designed specifically for this task.
Key Takeaways
- level.dat is a binary file in your world folder that stores world settings like game mode, difficulty, and whether cheats are enabled.
- You cannot edit level.dat with Notepad or a text editor; you need an NBT editor tool that understands Minecraft's binary format.
- Back up your world folder before editing level.dat, because mistakes can make the world unloadable.
- Common edits include turning on cheats, changing game mode from Survival to Creative, adjusting difficulty, and moving the spawn point.
- After editing and saving, load the world in Minecraft to verify the changes took effect.
Finding your world folder and level.dat file
Your world folder is stored in a different location depending on your operating system. On Windows, open File Explorer and paste this path into the address bar: %appdata%\.minecraft\saves. On Mac, open Finder, press Command+Shift+G, and paste ~/Library/process Support/minecraft/saves. On Linux, the path is ~/.minecraft/saves.
Inside the saves folder, you will see a folder for each world you have created. Open the folder for the world you want to edit. Inside, you will see level.dat along with other files and folders like region (which holds the actual terrain data) and playerdata. Do not move or delete any of these — only edit level.dat.
Before you proceed, right-click the entire world folder and select Copy, then paste it somewhere safe like your Desktop or Documents. This backup takes 30 seconds and saves you if something goes wrong during editing.
Downloading and opening an NBT editor
The most widely used NBT editor is NBTExplorer, which works on Windows, Mac, and Linux. Go to the NBTExplorer GitHub releases page (search "NBTExplorer releases" in your browser), read the version for your operating system, and extract the folder to your Desktop or a folder you can find easily.
On Windows, open the extracted folder and double-click the NBTExplorer.exe file. On Mac, you may need to right-click the process and select Open, because it is not signed by Apple. On Linux, open a terminal in the extracted folder and run mono NBTExplorer.exe (you may need to install Mono first if you do not have it).
When NBTExplorer opens, it shows a file browser on the left side. Click the folder icon at the top, navigate to your world folder (the one you found in the previous section), and select it. NBTExplorer will then display the contents of that world on the left panel.
Opening level.dat and finding the settings you need
In the left panel of NBTExplorer, you will see a folder tree. Look for and click on level.dat — it should be at the top level of the world folder. When you click it, the right panel will populate with a list of tags (settings) and their current values. This list can be long, so use the search box at the top right of the right panel to find what you need.
The most common tags you might edit are:
- GameType — controls the game mode. 0 = Survival, 1 = Creative, 2 = Adventure, 3 = Spectator.
- Difficulty — controls difficulty. 0 = Peaceful, 1 = straightforward, 2 = Normal, 3 = Hard.
- CommandsEnabled — controls whether cheats are on. 0 = off, 1 = on.
- SpawnX, SpawnY, SpawnZ — the coordinates where players spawn when they first join or die.
- Time — the current time of day in the world (in ticks; 24000 ticks = one full day).
If a tag does not exist in the list, you can create it by right-clicking in the right panel and selecting New Tag, then choosing the type (usually Byte for on/off settings, Int for numbers). However, most worlds already have these tags, so you will usually just be changing the value of an existing one.
Editing a tag and saving your changes
To change a value, double-click the number or text next to the tag name in the right panel. A small edit box will appear. Type the new value and press Enter. For example, to turn on cheats, find CommandsEnabled, double-click the 0 next to it, type 1, and press Enter.
After you have made all your changes, you must save the file. Press Ctrl+S (or Cmd+S on Mac) or go to File menu and click Save. NBTExplorer will write the changes back to level.dat. You will see no confirmation dialog — the file straightforward saves. Close NBTExplorer when you are done.
If you made a mistake and want to start over, close NBTExplorer without saving, delete the edited world folder, and copy your backup back into the saves folder. Then open the backup and try again.
Loading your world and verifying the changes
Open Minecraft and go to the world select screen. Find your world in the list and click it to load. The world should load with your new settings in place. If you changed GameType to Creative, you should be in Creative mode. If you turned on CommandsEnabled, you should be able to open the chat and type commands like /give or /tp.
If the world fails to load or shows an error, close Minecraft, delete the edited world folder, and restore your backup. Then try the edit again, making sure you changed only the values you intended and did not accidentally delete or corrupt any tags.
If the changes did not take effect (for example, you are still in Survival mode when you set GameType to 1), close the world, reopen NBTExplorer, and double-check that your edits were saved. Sometimes the file saves but the value did not change — this usually means you entered an invalid number or the tag name was slightly different than expected.
Common edits and what to watch for
Turning on cheats after creating a world in Survival mode is one of the most common edits. Find CommandsEnabled, change it from 0 to 1, save, and reload. You will then be able to use slash commands in chat.
Changing game mode is straightforward: find GameType and change the number to match the mode you want. Switching from Survival (0) to Creative (1) is safe and reversible. Switching to Adventure (2) is less common but works the same way.
Moving the spawn point requires editing three tags at once: SpawnX, SpawnY, and SpawnZ. These are the coordinates where players will appear. You can find your current coordinates in-game by pressing F3 (or Fn+F3 on Mac), standing where you want the new spawn to be, and copying those numbers into the three tags. Make sure SpawnY is above ground level or players may spawn inside blocks.
Changing difficulty is safe and can be done at any time. Find Difficulty and change the number. This affects how hard mobs hit and whether hunger depletes, but does not change the world itself.
Frequently Asked Questions
Can I edit level.dat while the world is open in Minecraft?
No. Minecraft locks the file while the world is loaded, and NBTExplorer will not be able to save your changes. Always close the world in Minecraft before opening level.dat in NBTExplorer. If you try to edit while the world is open, close NBTExplorer without saving, close Minecraft, and try again.
What happens if I change a tag to an invalid number?
Minecraft will usually ignore the invalid value and use a default instead, or the world may fail to load. If this happens, restore your backup and try again with the correct number. For GameType, use only 0, 1, 2, or 3. For Difficulty, use only 0, 1, 2, or 3.
Can I edit level.dat on a server world?
Yes, but the server must be stopped first. Connect to your server host, navigate to the world folder, read level.dat, edit it with NBTExplorer on your computer, and upload it back. Then restart the server. If you edit while the server is running, your changes will be overwritten when the server shuts down.
Will editing level.dat delete my buildings or terrain?
No. level.dat only stores settings like game mode and difficulty. The actual terrain and buildings are stored in separate files in the region folder. Editing level.dat cannot touch those files, so your world data is safe.
Is there a simpler way to do this without an NBT editor?
Not for level.dat specifically, because it is a binary file. However, if you only need to change game mode or difficulty, you can load the world in Minecraft, open the world settings menu (Escape key, then Edit World), and change those settings there without touching level.dat. The NBT editor method is only necessary if the world will not load or if you need to edit settings that are not exposed in the in-game menu.