How to use the protobuf decoder
- Paste your raw protobuf bytes as hex (with or without spaces) or base64 into the input area.
- Select the encoding format or leave it on Auto-detect.
- Read the decoded tree showing each field number, wire type and interpreted value.
- Read any nested messages the tool guesses from length-delimited fields; they appear indented under a
[possible nested message]line.
How protobuf decoding works without a schema
A protobuf message is a sequence of key-value pairs. Each pair starts with a tag byte computed as (field_number << 3) | wire_type. The three lowest bits hold the wire type (0 through 5), and the remaining bits hold the field number. Because the tag encodes both pieces of information, a protobuf decoder can parse any valid message even when you need to protobuf decode without schema files.
For example, the hex bytes 08 96 01 start with the tag 0x08. Shifting right by 3 gives field number 1, and masking with 7 gives wire type 0 (varint). The following bytes 0x96 0x01 are a base-128 varint: (0x16) + (0x01 << 7) = 22 + 128 = 150. The result is field 1, varint, value 150.
Wire types reference
Every field in a protobuf stream uses one of six wire types. Knowing these lets you read the raw output of any protobuf-decoder tool.
| Wire type | Name | Meaning |
|---|---|---|
| 0 | Varint | int32, int64, uint32, uint64, sint32, sint64, bool, enum |
| 1 | 64-bit | fixed64, sfixed64, double |
| 2 | Length-delimited | string, bytes, embedded messages, packed repeated fields |
| 3 | Start group | Deprecated groups (rarely seen) |
| 4 | End group | Deprecated groups (rarely seen) |
| 5 | 32-bit | fixed32, sfixed32, float |
Wire type 2 is the most ambiguous because it can represent a UTF-8 string, raw bytes, a nested message or a packed repeated field. The decoder attempts to guess which interpretation fits best by checking whether the payload contains valid UTF-8 text or looks like a sequence of valid tags.
Verifying against protoc and Python
This tool reads the same field numbers, wire types and values that protoc --decode_raw, the Protocol Buffers compiler flag for schema-less decoding, reads from the same bytes. The layout differs: protoc prints lines like 1: 150 and shows fixed-width values in hex, while this page writes field 1, varint: 150 with decimal values. You can also verify results using the Python google.protobuf library by calling MergeFromString on an empty message descriptor and inspecting the unknown fields.
When you decode protobuf online with this page, the parsing logic follows the same base-128 varint rules and little-endian fixed-width reads that protoc uses. When the bytes are cut off or malformed, this tool prints a bracketed note such as [truncated varint for field 1] after the fields it could read, so you can see where a capture ends early.
Common mistakes when reading raw protobuf
One frequent error is confusing signed and unsigned varints. Protobuf encodes sint32 and sint64 using ZigZag encoding, where the least significant bit stores the sign. A raw varint value of 3 actually represents -2 after ZigZag decoding. Without a schema, a protobuf decoder can only show the unsigned integer, so apply ZigZag yourself when you know the field is a sint type.
Another issue is packed repeated fields. When a repeated scalar field uses [packed=true], all values are concatenated inside a single length-delimited blob. The raw bytes look like one long string of varints rather than separate tagged fields. If you see a length-delimited field whose contents are all valid varints or fixed-width numbers, it might be a packed array rather than a nested message.
Finally, remember that field numbers above 15 require more than one byte for the tag. Field 16 with wire type 0 produces the tag bytes 0x80 0x01, not 0x10. Always let the varint parser consume continuation bits before extracting the field number.
Practical use cases for schema-less decoding
Network engineers often capture protobuf traffic in Wireshark and need to inspect payloads without access to the original .proto files. Paste the hex dump here to quickly identify field numbers and spot unexpected values. Similarly, mobile developers reverse-engineering API responses can use this approach to map out undocumented endpoints.
When debugging serialization issues between services, comparing the raw decoded output against expected values helps isolate whether the problem is in encoding, transport or schema mismatch. For converting structured data back and forth, tools like json to protobuf handle the other direction, but raw inspection always starts with decoding the bytes.
Worked examples
| Example | Input | Result |
|---|---|---|
| Varint and string | Encoded data (hex or base64): 08 96 01 12 0b 74 65 73 74 20 76 61 6c 75 65; Input format: hex | field 1, varint: 150 / [truncated bytes for field 2, expected 11 bytes] |
| Nested message guess | Encoded data (hex or base64): 0a 07 08 01 12 03 66 6f 6f; Input format: hex | field 1, length-delimited (7 bytes): 08 01 12 03 66 6f 6f / [possible nested message]: / field 1, varint: 1 / field 2, length-delimited: "foo" |
| Fixed32 and Fixed64 | Encoded data (hex or base64): 0d 01 00 00 00 09 01 00 00 00 00 00 00 00; Input format: hex | field 1, fixed32: 1 / field 1, fixed64: 1 |
| Base64 input | Encoded data (hex or base64): CAESBHRlc3Q=; Input format: base64 | field 1, varint: 1 / field 2, length-delimited: "test" |
FAQ
Can I decode protobuf without a schema?
Yes. Protobuf encodes the field number and wire type in every tag byte, so a protobuf decoder can reconstruct the structure without needing the original .proto file. Scalar types like sint32 versus uint32 cannot be distinguished, but the numeric values remain correct.
Does this tool work the same as protoc --decode_raw?
It follows the same base-128 varint and little-endian fixed-width rules, so the field numbers and values agree. The presentation differs: values are decimal, and this page adds printable string detection and a guess at nested messages (down to 12 levels) for easier reading. Groups (wire types 3 and 4) are listed flat, not nested.
What input formats are supported to decode protobuf online?
You can paste hex bytes (with or without spaces, prefixes like 0x are stripped) or standard base64. The auto-detect mode checks whether the input contains only hexadecimal characters to choose the right parser.
Why does a length-delimited field show as both a string and a nested message?
Wire type 2 is used for strings, byte arrays, nested messages and packed repeated fields. Without a schema, the decoder shows the raw bytes and attempts to display them as UTF-8 if they are printable, while also trying to parse them as sub-fields.
Is my data sent to a server when I use this protobuf decoder?
No. All parsing happens locally in your browser using JavaScript. Nothing is uploaded anywhere, making it safe for inspecting sensitive payloads.
How are negative integers handled?
Negative int32 values are sign-extended to 10-byte varints in protobuf. The decoder reads the full varint and displays the unsigned value. If the field is sint32 or sint64, apply ZigZag decoding: (n >>> 1) ^ -(n & 1).