Format:KeyValues1 (VDF, ACF)
| Developer | Valve |
|---|---|
| Extensions | .vdf, .acf, .res, .vmt, .txt, .bin |
| Endianness | little |
| License | open parsers: MIT |
| On this wiki | Facts · Code · Notes · Topics |
Valve's original KeyValues format (KV1) used by Source engine games and the Steam client: a text form (.vdf, .acf, .res, .txt) of quoted keys and nested braces, and a binary form with one type byte per node.
Overview
KeyValues 1 is a tree of named nodes; a node holds either a string/number value or child nodes. It appears as text in .vdf, .acf (Steam app manifests), .res, .vmt and as a binary stream in Steam data files (Format:Steam appinfo and packageinfo, shortcuts.vdf) and in Source network and cache files. The successor for Source 2 is Format:KeyValues3 binary; archives that hold such files include Format:VPK (Valve package). Steam client files are described in Format:Steam client data files.
Text syntax
Read in SteamDatabase/ValveKeyValue (MIT) at commit 28ca0e5, Deserialization/KeyValues1/KV1TokenReader.cs and KVConditionEvaluator.cs:
- Keys and values are quoted strings, but unquoted tokens are accepted; an unquoted string ends at whitespace, a quote, a brace or
=. - A key followed by
{ ... }is a child block; otherwise the next string is the value. - Comments start with
//(the reader also accepts a single/). - Inside quoted strings the backslash escapes
\n \t \v \b \r \f \a \\ \? \' \"when escape sequences are enabled; Valve's own parser treats an unknown escape as a null byte that truncates the string (the library has an option to copy this bug). #include "file"appends keys of another file;#base "file"loads a base file whose keys are merged recursively. Both are directives only at document level, outside the root block, and are matched case-insensitively.- A conditional such as
[$WIN32]after a key or value keeps the entry only if the expression is true. Expressions support$NAME, numbers,!,&&,||and parentheses;&&and||have equal precedence, left to right, modelled on Valve's tier1 exprevaluator.
Binary syntax
Each node is: type byte, key, payload. Types: 0x00 child block (nested nodes until an end byte), 0x01 UTF-8 zero-terminated string, 0x02 int32, 0x03 float32, 0x04 pointer, 0x05 wide string, 0x06 color (int32), 0x07 uint64, 0x08 end of block, 0x09 binary blob (u32 length), 0x0A int64, 0x0B alternate end (Source 2). The root is one node followed by a final end byte.
- Keys are zero-terminated UTF-8 strings, or, in appinfo version 41 files, an int32 index into a string table stored at the end of the file.
- Steam writes wide strings with an int32 character count including the terminator; Source 2 writes an int16 count without terminator.
- Pointers are 4 bytes in Source 1 and 8 bytes in Steam and Source 2 (the .NET reader only supports 4).
- Source 2 style streams can start with the magic
VBKV(56 42 4B 56) followed by a CRC32 of the data.
Parsers
See Library:ValveKeyValue (C#) and ValvePython/vdf (Python; same type table, alt_format flag selects 0x0B as end byte).
Unverified: Valve's own implementation is tier1/KeyValues.cpp in source-sdk-2013; I did not read it, the type table above comes from the open parsers.
Code & repositories
- https://github.com/SteamDatabase/ValveKeyValue @
28ca0e5222367bce31facd9fe1c1e14f5bdb4e81· license: MIT
MIT .NET reader/writer for KeyValues1 text and binary, KV3 text
Tested on: source read, not run: source read · checked 2026-10-18; last activity 2026-10-17 - https://github.com/ValvePython/vdf @
d76292623e326fb165fe3bdb684832cdf30959d4· license: MIT
MIT Python text and binary VDF parser
Tested on: source read, not run: source read · checked 2026-10-18; last activity 2024-06-30