Protobuf Wire Decoder
Paste hex or base64 protobuf bytes and read field numbers, wire types and every plausible value: unsigned and zigzag varints, string, bytes or nested message.
The interactive tool loads here when JavaScript runs.
About this toolWhat is the Protobuf Wire Decoder?
Paste the hex or base64 of a protobuf message, from a log line, a Kafka topic, a gRPC capture or a file that starts with unprintable bytes, and read it without the .proto: each field's number, its wire type, and its value. The bytes are decoded in your tab and sent nowhere.
The honest part is the plural. A protobuf tag carries only the field number and one of six wire types, and the encoding guide at protobuf.dev says the declared type "can only be determined on the decoding end by referencing the message type's definition (i.e. the .proto file)". So a varint is shown as both its unsigned value and its zigzag (sint) reading, a fixed 32- or 64-bit field as both an integer and a float or double, and a length-delimited payload as a string, as bytes, and as a nested message whenever it parses as one. A decoder that picks one reading for you is guessing; this one shows you the candidates and lets your schema knowledge settle it.
That is the same line protoscope draws, the schema-less disassembler the encoding guide itself uses for its examples: its README calls its heuristics "necessarily imperfect", because without the schema they have to be.
- Hex or base64 input, auto-detected, with spaces and 0x prefixes tolerated
- Every plausible reading per field: unsigned and zigzag varints, integer and float fixed fields, string, bytes and trial-decoded nested messages
- Ambiguity called out when a payload reads as both text and a message
- Recursive nested decode to 10 levels, rendered as an indented tree
- Copyable one-line-per-field text form, the shape protoscope prints
- Clear refusals: field number 0, deprecated groups, truncated varints and overlong lengths named at their byte offset
- Runs entirely in your browser; the bytes are never uploaded
Updated
How to use the Protobuf Wire Decoder
- Get the bytes as text: a hex dump from tcpdump or Wireshark, the base64 a logging library printed, or hex copied from a debugger. Both encodings work, with or without spaces and 0x prefixes.
- Paste them and press Decode, or press Load a sample to see the encoding guide's field 1 = 150 example with a string, a nested message and a double beside it.
- Read the field table: number, wire type, then every reading that fits. The first reading is the most common interpretation; the grey ones are the alternatives only your .proto can rule out.
- Match field numbers to your schema. If field 2 in the output is a 7-byte string and your .proto says string name = 2, you have your mapping; if a field number appears that your schema lacks, you are looking at a different or newer message type.
- Copy the text form for a ticket or diff. It is one line per field, the same shape protoscope prints.
Worked examples
The encoding guide's own three bytes
Input
08 96 01
Output
1: varint 150 (as sint: 75)
Tag 0x08 is (1 << 3) | 0: field 1, wire type VARINT. The bytes 96 01 decode to 150 because each varint byte carries 7 bits, low group first. If the schema declared sint32 instead of int32, the same bytes would mean 75; both readings are printed because the wire format does not say.
A nested message, found by trying
Input
1a 03 08 96 01
Output
3: message? (3 bytes) with 1: varint 150 indented under it
Field 3 is LEN with a 3-byte payload. The payload parses cleanly as a message holding field 1 = 150, so the nested reading is shown with a question mark: valid protobuf, but only the .proto knows whether field 3 was declared as a message or as bytes that merely happen to parse.
Genuinely ambiguous: "hi" or field 13 = 105
Input
0a 02 68 69
Output
1: message? (2 bytes) 68 69, plus the note: also reads as text "hi"
The two payload bytes are printable ASCII and also a well-formed message (tag 0x68 is field 13 varint, value 0x69 = 105). Both readings are shown. This is the case that separates a decoder from a guesser, and why the output marks trial decodes with "message?" instead of asserting them.
Fixed 64 bits: integer or double
Input
21 00 00 00 00 00 00 45 40
Output
4: i64 4631107791820423168 (as double: 42)
Wire type I64 is eight little-endian bytes that could be a fixed64, sfixed64 or double. The unsigned integer reading looks like noise; the double reading is exactly 42, which is usually the tell. The decoder prints both and you pick the one that looks like data.
Background and insight
A protobuf message is a flat sequence of tag-value records with no header, no length and no field names. Each tag is a varint holding (field_number << 3) | wire_type. The six wire types are VARINT (0), I64 (1), LEN (2), the deprecated group markers SGROUP (3) and EGROUP (4), and I32 (5). The encoding guide's own first example is the three bytes 08 96 01: tag 0x08 is field 1 with wire type 0, and 96 01 is the varint 150, each byte carrying 7 payload bits with the high bit flagging continuation, least significant group first.
LEN is where the ambiguity concentrates. The guide's wire type table lists it as used for string, bytes, embedded messages and packed repeated fields, four different declared types behind one wire type. This decoder tries a recursive decode of every LEN payload: if the bytes parse cleanly as a message, that reading is shown with its fields indented, and if they are also printable UTF-8, the text reading is shown beside it. Two bytes like 68 69 really do read as both the string "hi" and a message holding field 13 = 105, and nothing in the bytes says which was meant.
Negative numbers explain the two varint readings. A plain int32 of -1 encodes as ten bytes of varint, so proto's sint types zigzag first: 0 becomes 0, -1 becomes 1, 1 becomes 2, -2 becomes 3, mapping small negatives to small varints. The same wire byte 0x01 therefore means 1 in an int field and -1 in a sint field. Both readings are printed whenever they differ; groups, deprecated since early proto2, are named and refused rather than half-followed.
Common use cases
A payload from a queue or log with no schema at hand
Base64 from Kafka, Pub/Sub or a debug log decodes into numbered fields in seconds; matching them against the .proto you eventually find confirms you grabbed the right message type.
Confirming what a producer actually sent
When consumer and producer disagree, the wire bytes are the arbiter: a missing field on the wire was never sent, whatever the producer's code intends.
Reverse-engineering an undocumented API
Mobile apps and embedded devices often speak protobuf without publishing schemas. Field numbers, types and nesting are enough to reconstruct a workable .proto, which is how protoscope is used too.
Checking gRPC captures without replaying them
A gRPC message body, once the 5-byte length-prefixed framing is stripped, is a plain protobuf message and decodes here; the field table says what crossed the wire.
Learning the encoding
Type bytes by hand and watch the tag split into field number and wire type; the guide's examples all decode here exactly as written.
Tips and limitations
- Strip framing first. gRPC prefixes each message with 1 compression byte and a 4-byte big-endian length; protobuf-over-HTTP bodies sometimes carry no framing at all. If decoding fails at byte 0, the first bytes are probably framing, not protobuf.
- A failed decode is information: real protobuf never has field number 0, and a length that runs past the end usually means the input is truncated or not protobuf at all. The error names the byte where it died.
- Packed repeated numbers (proto3's default for scalars) arrive as one LEN payload that is neither text nor a valid message, so it shows as bytes; a run of small varints inside is the tell.
- Fixed fields have no signed reading here: an sfixed64 of -2 shows as the unsigned 18446744073709551614 with no float reading, so translate large "all but a few bits set" integers as likely negatives.
- The trial decode recurses 10 levels deep and marks every successful nested parse with "message?". Treat it as a candidate, not a verdict: short byte strings parse as messages surprisingly often, the "hi" example being two bytes long.
- For the reverse direction, writing bytes from a text description, use protoscope itself; this page only reads.
Sources and further reading
- Protocol Buffers: Encoding, protobuf.dev. The wire format: tags, the six wire types, varints, zigzag, the 08 96 01 example
- Protoscope, protocolbuffers on GitHub. The schema-less wire format disassembler whose heuristic approach this tool mirrors
Frequently asked questions
Can I decode protobuf without the .proto file?
Yes, structurally: field numbers, wire types and values are all in the bytes, and this page shows them. What is not in the bytes is the declared type and the field names; the encoding guide says those can only be determined by referencing the .proto. So you get "field 2, 7-byte string, testing", not "name: testing".
Why does the output show two values for one varint field?
Because int and sint types share wire type 0 but encode differently. sint fields zigzag first (0, -1, 1, -2 map to 0, 1, 2, 3), so the wire value 1 means 1 as int32 but -1 as sint32. Both readings are printed whenever they differ; your schema says which applies.
What does "message?" mean in the decoded output?
The length-delimited payload parsed cleanly as a nested protobuf message, so that reading is shown with its fields indented. The question mark is honest: bytes and strings can parse as messages by coincidence, and only the schema distinguishes an embedded message from bytes that happen to decode.
Why do some fields decode as both a string and a message?
LEN payloads carry strings, bytes, embedded messages and packed repeated fields, per the wire format's own table. When a payload is printable UTF-8 and also well-formed protobuf, both facts are true of the bytes, and the tool reports both rather than pick. The two-byte string "hi" is a working example.
Does this handle gRPC messages?
The message body, yes. gRPC wraps each message in a 5-byte prefix (one compression flag byte, then a 4-byte big-endian length) before the protobuf bytes. Strip those 5 bytes, or start pasting after them, and the rest decodes here. A decode error at byte 0 on a gRPC capture is almost always this framing.
What are protobuf wire types?
The six on-the-wire shapes a field can take: VARINT (0) for variable-length integers, I64 (1) for fixed 8-byte values, LEN (2) for length-prefixed payloads, SGROUP (3) and EGROUP (4) for deprecated groups, and I32 (5) for fixed 4-byte values. The tag before each field encodes (field_number << 3) | wire_type.
Why does the decoder refuse group wire types?
Groups (wire types 3 and 4) are deprecated, and misreading one risks presenting garbage confidently: the start and end markers must pair up by field number for the message to be well-formed. Refusing by name tells you the payload is old-style proto2 or, more often, not protobuf at all.
Is there an in-depth guide to the Protobuf Wire Decoder?
Yes. “How to Decode Binary Formats Without the Schema” covers the background, how it works, common pitfalls and worked examples. Read the full guide.
Related Tools You May Like
Free, in-browser tools that pair well with this one.