Thrift Decoder
Decode Apache Thrift Binary and Compact messages in your browser with no IDL — struct, map, list and set trees, TFramed detection and byte highlighting.
Data is processed only in your browserHow to use
Thrift Decoder turns an Apache Thrift binary message back into a field tree with no .thrift file required. It understands both the Binary and Compact protocols, detects the message envelope for you, and when a TFramed length prefix is present it splits the input into frames and decodes each one. Every node records the exact byte range it occupies, and the hex pane highlights those bytes in sync, so you can check how a particular value was actually encoded.
How to use: paste the message as hex or Base64, or upload a binary file (up to 2 MB). Protocol defaults to Auto but can be pinned to Binary or Compact; transport is Auto too — a recognised 4-byte length prefix switches to TFramed, anything else is decoded as a bare message. The sample menu has one Compact and one Binary message to try. Your input is never added to the address bar automatically. To reproduce it, use “Share link” to copy a link containing the original bytes (up to 6,000 bytes), and share only non-sensitive data.
Binary protocol type ids
| Type | Id | Wire format |
|---|---|---|
| STOP | 0 | End of a struct, one byte |
| BOOL | 2 | One byte, 1 true and 0 false |
| BYTE | 3 | One signed byte |
| DOUBLE | 4 | 8 bytes, IEEE 754 |
| I16 / I32 / I64 | 6 / 8 / 10 | 2 / 4 / 8 signed bytes |
| STRING | 11 | 4-byte length plus UTF-8 bytes (also carries binary) |
| STRUCT | 12 | Nested struct, terminated by STOP |
| MAP | 13 | Key type, value type, 4-byte size, then pairs |
| SET / LIST | 14 / 15 | Element type, 4-byte size, then elements |
| UUID | 16 | 16 raw bytes |
Binary versus Compact
| Aspect | Binary | Compact |
|---|---|---|
| Encoding | Big-endian fixed width | Varint with ZigZag for signed integers |
| Field header | Type byte plus 2-byte field id | Delta and type packed into one byte; a full field id only when the delta falls outside 1-15 |
| double | 8 bytes big-endian | 8 bytes little-endian |
| Container size | Fixed 4 bytes | Up to 14 elements in the type byte, otherwise a long form plus varint |
| Message header | 0x80010000 | type, then name and sequence id | 0x82 plus a type byte, then the sequence id (varint) and name |
What the bytes can and cannot tell you
The wire carries field ids and values only: field names, enum labels, struct names and union member names exist solely in the IDL. Without the .thrift they cannot be recovered, and enum values stay numeric. A union looks exactly like a struct on the wire, so the tool can only warn that at most one member should be set, not tell you which one. string and binary share one type id — the tool shows text when the payload decodes cleanly as UTF-8 and hex bytes otherwise. required and optional are not on the wire either.
Troubleshooting
Decoding stops at an offset? Usually truncated bytes, the wrong protocol, or two protocols mixed in one buffer. The tool keeps every node decoded before the break and marks the offset on the error node.
Numbers look wrong? Most often the protocol is wrong: Compact uses ZigZag plus varint, so the same bytes read as Binary give completely different values. Confirm whether the peer uses TBinaryProtocol or TCompactProtocol.
The TFramed length does not match? The prefix is not a 4-byte big-endian length, or there is another protocol layer around the data. Pin both protocol and transport, then compare section by section.
Frequently asked questions
Can it decode without the Thrift IDL?
Yes. The tool reads the Thrift wire format itself, so no .thrift file is needed: Binary splits on a fixed type byte plus a 2-byte field id, Compact splits on the packed delta-and-type field header. That also means field names, enum labels and struct names cannot be recovered — what is certain is the field id, type and value.
What is the difference between Binary and Compact?
Binary is big-endian and fixed-width: i16/i32/i64 take 2/4/8 bytes, each field header is a type byte plus a 2-byte field id, and doubles are big-endian. Compact ZigZag-encodes signed integers and then varint-encodes them, packs the field-id delta and type into one byte, and stores doubles little-endian instead — the same value is usually far smaller. The tool detects both and also lets you pin one.
Do I need to strip the length prefix first?
No. TFramed transport prefixes each message with a 4-byte big-endian length; the tool detects that and decodes frame by frame, showing each frame boundary and any trailing bytes. Paste the length prefix along with the payload.
Can it recover field names, enum labels or union members?
No. Those live only in the IDL; the bytes carry just field ids and numbers. Enum values stay numeric i32s. A union looks exactly like a struct on the wire, so the tool can only warn that at most one field is set, not tell you which one. (string and binary share one wire type, so the tool shows text when the payload decodes cleanly as UTF-8 and hex bytes otherwise.)