Format:KeyValues3 binary
| Magic | 56 4B 56 03 (VKV3 0x03) or 01 33 56 4B .. 05 33 56 4B (KV3 + version) |
|---|---|
| Extensions | embedded in *_c DATA blocks; .vdata_c, .vpcf_c, .vsndevts_c |
| Endianness | little |
| On this wiki | Facts · Code · Notes · Topics |
Valve's KeyValues3 data language as stored in Source 2: a text form (first line is a comment-style header naming the text encoding and the format, each with a GUID) and a binary form identified by magic VKV3 or KV3 plus a version byte 1-5, with optional LZ4 or Zstandard compression of the buffers and a GUID naming the format.
KeyValues1, the older text/binary predecessor used by Steam and Source 1, is on Format:KeyValues1 (VDF, ACF).
Identification
Magic as read by ValveResourceFormat (MIT) BinaryKV3.cs: 0x03564B56 (bytes 56 4B 56 03, 'VKV' 3, the oldest binary form), then 0x4B563301 to 0x4B563305 (bytes 01 33 56 4B ... 05 33 56 4B, i.e. 'KV3' with the version in the lowest byte of the little-endian u32). So five versions exist besides the VKV form. KV3 blobs mostly sit in the DATA block of a Format:Source 2 compiled resource (_c), or in CTRL / RED2 / FLCI / DSTF blocks.
Binary header (after magic)
From ReadBuffer:
- Format GUID, 16 bytes (names the schema/encoding, for example the 'generic' format
7C161274-E906-9846-AFF2-E63EB59037E7in the little-endian byte order stored in the file; ValveResourceFormat's KV3IDLookup lists animgraph and other format GUIDs). - Compression method u32: 0 none, 1 LZ4, 2 Zstandard (Format:Zstandard, Format:LZ4).
- Version 1: byte counts for 1-, 4- and 8-byte values (3 x i32) and total uncompressed size i32; the compressed size is the rest of the block.
- Version 2 and later: u16 compression dictionary id, u16 compression frame size, counts of 1-, 4- and 8-byte values (i32 each), type count i32, object count u16, array count u16, uncompressed total i32, compressed total i32, block count i32, binary blob size i32.
- Version 4 and later: count of 2-byte values and size of the block-compressed-size table.
- Version 5: a second buffer: uncompressed/compressed size of buffer 1 and buffer 2 and their value counts plus node/object/array/element counts. Uncompressed total = buffer1 + buffer2.
Binary blobs and sections end with the trailer 0xFFEEDD00 (the reader asserts it). LZ4 here is block or chained-block data with a frame size; Zstandard data before version 5 is two consecutive frames (buffer and blobs).
Node types
Values are tagged with a type byte (flag bits 0x80 and 0x40 add a flag/annotation, the type lives in the low 6 or 7 bits). Types include null, booleans, int64 zero/one, double zero/one, uint32 zero/one, strings, arrays, objects and binary blobs. Names are in a string table; the exact enum is KV3BinaryNodeType in ValveResourceFormat.
Text form
Plain text KV3 files begin with a one-line header in comment syntax (the characters 'kv3', then 'encoding:text:version{GUID}' and 'format:NAME:version{GUID}'); the format GUID is the same one the binary header stores (little-endian byte order). Unverified: exact header text was not read from the repository. Source 2 tools write .vdata, .vpcf and .vsndevts sources in this form, and the compiled _c files carry the binary form.
Tools
ValveResourceFormat (MIT) reads and writes both forms; SteamDatabase also publishes ValveKeyValue (KV1 and KV3 text).
Code & repositories
- https://github.com/ValveResourceFormat/ValveResourceFormat @
16a6e739da35664f974ca74d716480fe4a2fcda9· license: MIT
C# library, CLI and viewer for Source 2 resources: block table, KV3 binary, textures, models, maps
Tested on: source read, not run: source read, not run · checked 2026-10-18; last activity 2026-10-18; Note: the latest release ships binaries; the wiki links only the source, never the binaries