SharpNBT 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SharpNBT --version 1.1.0
NuGet\Install-Package SharpNBT -Version 1.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SharpNBT" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SharpNBT --version 1.1.0
#r "nuget: SharpNBT, 1.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SharpNBT as a Cake Addin
#addin nuget:?package=SharpNBT&version=1.1.0

// Install SharpNBT as a Cake Tool
#tool nuget:?package=SharpNBT&version=1.1.0


.NET License Version Downloads

Java Bedrock

A CLS-compliant implementation of the Named Binary Tag (NBT) specifications (Java/Bedrock), written in pure C# with no external dependencies and targeting a wide variety of .NET implementations and languages on all platforms.


  • Java/Bedrock Support: Supports all NBT protocols used by different versions of Minecraft, including: Java, Bedrock (file protocol), and Bedrock (network protocol), including full support for either GZip/ZLib compression, big/little endian, and variable length integers with optional ZigZag encoding.
  • Ease-of-use: An intuitive API design, following the style and conventions of the .NET runtime, with full Intellisense for every member: Spend more time being productive and less time digging through documentation.
  • Performance: Leverages the power of modern C# language features, including Span with stackalloc, MemoryMarshal, etc. This allows for a type-safe way to reinterpret raw buffers without pointers or making unnecessary copies of buffers, a common pitfall with serialization in type-safe languages.
  • Concurrency: Includes standard async/await concurrency patterns for reading and writing.
  • Cross-platform and cross-language support: Fully CLR compliant and build against .NET Standard 2.1, allowing support for any CLR language (i.e. C#, Visual Basic, F#, etc.) for the following runtime versions or greater:
    • .NET Standard 2.1
    • .NET 5.0
    • .NET Core 3.0
    • Mono 6.4
    • Xamarin.iOS 12.16
    • Xamarin.Mac 5.16
    • Xamarin.Android 10.0
    • Unity 2021.2.0b6
  • Callbacks: Can subscribe to events that get a callback as the parser steps through a stream to get immediate feedback without waiting for document completion. This allows subscribers to even parse the payload themselves and handle the event entirely.
  • String NBT: Supports both generating and parsing arbitrary SNBT strings.


Please see the wiki for more detailed explanations. Feel free to improve it by contributing!


At its simplest, reading an NBT document is one-liner:

CompoundTag tag = NbtFile.Read("/path/to/file.nbt", FormatOptions.Java, CompressionType.AutoDetect);


Likewise writing a completed NBT tag is a one-liner:

// Assuming "tag" is a valid variable
NbtFile.Write("/path/to/file.nbt", tag, FormatOptions.BedrockFile, CompressionType.ZLib);


While there is functionality to output NBT to other human-readable formats like JSON, if you simply need to visualize a tag, there is a custom "pretty printed" output you can use:

bigtest.nbt from

var tag = NbtFile.Read("bigtest.nbt", FormatOptions.Java, CompressionType.GZip);
TAG_Compound("Level"): [11 entries]
    TAG_Long("longTest"): 9223372036854775807
    TAG_Short("shortTest"): 32767
    TAG_String("stringTest"): "HELLO WORLD THIS IS A TEST STRING ÅÄÖ!"
    TAG_Float("floatTest"): 0.49823147
    TAG_Int("intTest"): 2147483647
    TAG_Compound("nested compound test"): [2 entries]
        TAG_Compound("ham"): [2 entries]
            TAG_String("name"): "Hampus"
            TAG_Float("value"): 0.75
        TAG_Compound("egg"): [2 entries]
            TAG_String("name"): "Eggbert"
            TAG_Float("value"): 0.5
    TAG_List("listTest (long)"): [5 entries]
        TAG_Long(None): 11
        TAG_Long(None): 12
        TAG_Long(None): 13
        TAG_Long(None): 14
        TAG_Long(None): 15
    TAG_List("listTest (compound)"): [2 entries]
        TAG_Compound(None): [2 entries]
            TAG_String("name"): "Compound tag #0"
            TAG_Long("created-on"): 1264099775885
        TAG_Compound(None): [2 entries]
            TAG_String("name"): "Compound tag #1"
            TAG_Long("created-on"): 1264099775885
    TAG_Byte("byteTest"): 127
    TAG_Byte_Array("byteArrayTest (the first 1000 values of (n*n*255+n*7)%100, starting with n=0 (0, 62, 34, 16, 8, ...))"): [1000 elements]
    TAG_Double("doubleTest"): 0.4931287132182315

Much More!

There is much more to SharpNBT than the examples above, please see the wiki for more details, with real-world examples.


Bug reports and pull requests are welcome on GitHub at This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Pull requests are always welcome.


The project is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the SharpNBT project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Special Thanks

This project would not be possible without all the contributors to the site and its maintainers, who have created an invaluable source of information for developers for everything related to the game of Minecraft.

If you benefit from this project, please consider supporting it by giving it a star on GitHub!

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on SharpNBT:

Package Downloads

Package Description


Package Description


Package Description


Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.1 1,264 9/1/2023
1.3.0 165 8/27/2023
1.2.0 1,759 9/18/2021
1.1.0 2,343 9/1/2021
1.0.0 1,280 8/25/2021