Что такое формат файла XNB?
.xnb is a compiled binary file that stores a single game resource produced by the XNA Game Studio Content Pipeline. .xnb is a binary format and can contain images, audio data, 3D models, fonts, and many other resources. Source assets such as .png textures or .wav audio clips are compiled at build time into platform-optimized .xnb files that the game loads at runtime via Content.Load<T>().
Every .xnb file opens with the ASCII tag XNB, followed by a target-platform byte (w for Windows, x for Xbox 360, m for Windows Phone) and a format-version byte. An optional LZX or LZ4 compression flag is encoded in the same header.
XNA is a set of development tools for creating games for Microsoft Windows, Windows Phone, and Xbox systems. The XNA development environment was based on Visual Studio Express and was available for free, offering a rich set of tools and features for game developers. Microsoft discontinued XNA with version 4.0 in 2010, ending support around 2014. The open-source MonoGame and FNA frameworks continue to read and write the same .xnb format, keeping it relevant for titles like *Terraria*, *Stardew Valley*, and *Celeste*, which ship their art and audio as .xnb files.
Third-party tools, including xnbcli and XnbExtract, can unpack .xnb content back into editable source assets. Related XNA audio bank files use the .xsb and .xwb extensions.
Безопасность и защита
РИСК: LOWAn XNB is inert compiled game data - a texture, sound or data table - with no scripting or executable content, so opening or extracting one is not dangerous in itself. Two practical cautions: extracting or redistributing a game's assets is governed by that game's copyright/EULA (fine for personal mods, not for redistribution), and you should download XNB tools from their official repositories (GitHub) rather than random "xnb opener" sites, which are often ad/PUP traps since no legitimate standalone double-click viewer exists.
Детали формата
в двух словахПрограммы, открывающие файлы XNB
Технические подробности
глубокая спецификация| File encoding | Binary, little-endian byte order |
| Magic bytes | 0x58 0x4E 0x42 (ASCII "XNB") at offset 0 |
| Header layout | 3-byte ASCII tag "XNB" + 1-byte platform code + 1-byte format version + 1-byte flags + 4-byte total file size (little-endian uint32) |
| Platform codes | 'w' (0x77) = Windows, 'x' (0x78) = Xbox 360, 'm' (0x6D) = Windows Phone/Mobile - encoded in byte 3 of every header |
| Format version | Versions 1-5; version 5 corresponds to XNA Game Studio 4.0 and is the version targeted by MonoGame and FNA |
| Compression | Optional - LZX (XNA 4.0) or LZ4 (some MonoGame builds); signalled by a flag bit in the header flags byte; payload is often stored uncompressed |
| Content types supported | Textures (DXT1/DXT3/DXT5/Color RGBA), audio (PCM/ADPCM), 3D models, bitmap fonts, compiled effect shaders, sprite sheets |
| Type-reader manifest | Header embeds a serialized list of ContentTypeReader class names the runtime uses to deserialize the asset object graph |
| Assets per file | One primary asset per .xnb file; shared sub-resources are nested within the same file's serialized object graph |
| Texture surface formats | Color (32-bit RGBA), DXT1 (opaque 4:1 block-compressed), DXT3, DXT5 - GPU-native formats that reduce VRAM footprint at load time |
| Typical file size | A few KB for small fonts or sprites; up to tens of MB for high-resolution textures or uncompressed audio tracks |
| Integrity check | Total file size stored as a 4-byte little-endian field in the header for basic validation; no cryptographic checksum or hash is included |
| Encryption | Not encrypted - compiled assets are stored as plain binary data readable by any implementation that supplies the correct ContentTypeReader |
| MIME type | application/octet-stream (no dedicated MIME type registered for .xnb) |
| Content Pipeline role | Runtime output of the XNA/MonoGame Content Pipeline - source files (.png, .wav, .fbx, .spritefont) are compiled at build time into .xnb and loaded at runtime via Content.Load<T>() |
| Notable adopters | MonoGame and FNA (open-source XNA successors); used to ship assets in Terraria, Stardew Valley, Bastion, Fez, and Celeste |
| Выпущен | 2006 (XNA Game Studio Express / XNA Framework 1.0) |
| Последняя версия | XNB format 5 (XNA Game Studio 4.0, 2010); same format reused by MonoGame/FNA |
| Спецификация | en.wikipedia.org |
Конвертации XNB
Вопросы и ответы сообщества
спрошено пользователямиВопросов пока нет - станьте первым, кто спросит о файлах XNB.