Minecraft Wiki
Advertisement
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Dark Oak Sapling
This article is a stub. 
You can help by expanding it.

The Named Binary Tag format is used by Minecraft for the various files it saves data to. The format is described by Notch in a very brief specification. The format is designed to store data in a tree structure made of up various tags. All tags have an ID and a name. The original known version was 19132, and since then has been updated to 19133 with Anvil, with the addition of the Int Array tag.

TAG definition

A tag is an individual part of the data tree. The first byte in a tag is the tag type (ID), followed by two bytes for the length of the name, then the name as a string in UTF-8 format. Finally, depending on the type of the tag, the bytes that follow are part of that tag's payload. This table describes each of the 11 known tags in version 19133 of the Named Binary Tag format:

ID Tag Type Payload Description
0 TAG_End None Used to mark the end of compound tags.
1 TAG_Byte 1 byte / 8 bits, signed A signed integral type. Sometimes used for booleans.
2 TAG_Short 2 bytes / 16 bits, signed, big endian A signed integral type.
3 TAG_Int 4 bytes / 32 bits, signed, big endian A signed integral type.
4 TAG_Long 8 bytes / 64 bits, signed, big endian A signed integral type.
5 TAG_Float 4 bytes / 32 bits, signed, big endian, IEEE 754-2008, binary32 A signed floating point type.
6 TAG_Double 8 bytes / 64 bits, signed, big endian, IEEE 754-2008, binary64 A signed floating point type.
7 TAG_Byte_Array TAG_Int's payload size, then size bytes. An array of bytes.
8 TAG_String TAG_Short's payload length, then a UTF-8 string with size length. A UTF-8 string. It has a size, rather than being null terminated.
9 TAG_List TAG_Byte's payload tagId, then TAG_Int's payload size, then size tags' payloads, all of type tagId. A list of tag payloads, without repeated tag IDs or any tag names.
10 TAG_Compound Fully formed tags, followed by a TAG_End. A list of fully formed tags, including their IDs, names, and payloads.
11 TAG_Int_Array (?) TAG_Int's payload size, then size*4 bytes. An array of TAG_Int's payloads.

The List and Compound tags can be and often are recursive.

File Format

An NBT file is a GZIPped Compound tag, name and tag ID included. Some of the files utilized by Minecraft may be uncompressed, but in most cases the files follow Notch's original specification and are compressed with GZIP. There is no header to specify the version or any other information.

Advertisement