Protobuf Decoder
Decode Protocol Buffers binary data without schema
Wire Types
Note
- • Decodes without .proto schema file
- • Field names are unknown (shows field numbers)
- • Embedded messages shown as bytes
- • Use protoc --decode_raw for verification
Protocol Buffers Guide
What is Protocol Buffers?
Protocol Buffers (protobuf) is Google's language-neutral, platform-neutral extensible mechanism for serializing structured data. It's smaller, faster, and simpler than XML or JSON, commonly used with gRPC.
Wire Format
Protobuf uses a compact binary format. Each field is encoded as a tag (field number + wire type) followed by the value.
Tag = (field_number << 3) | wire_type
Example: Field 1, string type = (1 << 3) | 2 = 0x0A
Encoding Examples
Varint (int32, int64, bool)
150 → 96 01 (0x9601)Each byte uses 7 bits for data, MSB indicates continuation
String
"Hello" → 0A 05 48 65 6C 6C 6FTag (0A) + Length (05) + UTF-8 bytes
Signed Integer (ZigZag)
-1 → 01, -2 → 03, 1 → 02, 2 → 04ZigZag encoding: (n << 1) ^ (n >> 31)
Getting Protobuf Data
# Capture gRPC traffic with grpcurl
grpcurl -plaintext -d '{"id": 1}' localhost:50051 myservice.MyMethod
# Encode with protoc
echo 'name: "test"' | protoc --encode=MyMessage message.proto | xxd -p
# Decode with protoc
cat data.bin | protoc --decode_raw