DevTools Logo

gRPC Wire Frame Encoder/Decoder

gRPC Wire Frame Encoder/Decoder

Turn JSON into length-prefixed gRPC frames or decode captured hex back into JSON — with your .proto, entirely in-browser.

Runs in your browser
Frame = 1 flag byte + 4-byte big-endian length + protobuf payload
Try an example

.proto schema

JSON payload

Frame hex

No framed payload yet.

Schema inspector

Select a message from a parsed .proto to see its field numbers and types.

Wire-type cheat sheet

Tag = (field number << 3) | wire type. A first tag byte of 0A means field 1, wire type 2.

WireNameUsed by
0Varintint32, int64, bool, enum, sint32/sint64 (zigzag)
164-bitfixed64, sfixed64, double
2Length-delimitedstring, bytes, embedded messages, packed fields
3 / 4Group start / endLegacy proto2 groups; shown as raw wire fields
532-bitfixed32, sfixed32, float

sint32/sint64 use zigzag: −1 becomes 1 on the wire. int32 negatives use a 10-byte sign-extended varint.

gRPC sends each message as a one-byte compression flag, a four-byte big-endian length, and a protobuf-encoded body. Paste a .proto schema, choose a message, and build the exact frame bytes (with or without the prefix), or paste a Wireshark/grpcurl hex capture to split its frames and decode each one. Compressed frames, unknown fields, multiple messages in a stream, and int64 precision are handled locally: nothing is uploaded.

Examples

Zigzag negative

Input
{"delta":-1}
Output
10 01

sint32 -1 zigzags to 1, so tag 0x10 is followed by a single-byte varint.

Packed repeated

Input
{"samples":[1,2,3]}
Output
22 03 01 02 03

proto3 repeated numeric fields are packed into one length-delimited field.

Length prefix

Input
00 00 00 00 03 08 96 01
Output
field 1 = 150

The header says three payload bytes: tag 0x08 and the varint 96 01.

About this tool

gRPC does not send JSON over the wire. Each message is encoded with protobuf, then wrapped in a five-byte frame: one compression flag byte, a four-byte big-endian length, and the payload itself. This tool builds and reads that frame directly, so you can replay messages through raw hex senders or inspect a capture without a running gRPC client.

Paste a .proto file, pick a message and enter JSON to get the exact frame hex. In the other direction, paste hex from Wireshark, grpcurl or a proxy log: frames are split at their declared lengths, flagged payloads are inflated when possible, and each body is decoded with field names from your schema. Fields the schema does not know are listed separately with their wire types and raw values.

Parsing and encoding use protobufjs inside the browser. Schemas, JSON bodies and captures stay in the tab; nothing is posted to a server. The tool stops at framing: it does not open HTTP/2 streams, send RPCs, or translate between proto and JSON schema formats.

What this tool does not do

  • This is a framing tool, not a gRPC client: no HTTP/2 transport, headers or trailers are sent or decoded.
  • Only frequently used google/protobuf well-known imports are bundled; other imports must be declared in the pasted schema.
  • Raw wire-field mode shows best-effort values for unknown fields; it does not reconstruct their original field names.
  • Frames and decoded output are capped at 16 MB to keep the browser responsive.

How to use this tool

  1. Paste a schema

    Add a .proto file in Encode mode and choose the message to encode. Well-known imports such as timestamp.proto are bundled.

  2. Enter JSON

    Write the payload using protobuf JSON field names. int64 values can stay as strings to preserve precision; bytes fields use base64.

  3. Build the frame

    Toggle the prefix, compression flag and optional deflate compression, then press Build frame to see the hex and byte count.

  4. Decode a capture

    Switch to Decode mode, paste hex (separators and 0x prefixes are allowed), pick a message or raw mode, and press Decode frames.

  5. Export

    Copy the hex or decoded JSON, or download the frame as .bin and the decoded result as .json. Mod+Enter re-runs the active action.

Use cases

Replay through a raw client

Generate byte-exact frame hex to paste into Postman, a mock server or a hex sender without grpcurl.

Trace capture analysis

Split interleaved frames from a Wireshark export and read each message with field names.

Teach the wire format

Show the flag byte, big-endian length, tags and varints next to the JSON that produced them.

Debug schema drift

Spot unknown field numbers when a sender uses a newer .proto than the receiver.

The five-byte frame header

BytesName
0Compression flag
1–4Message length
5…Message payload

The header length counts only the protobuf payload, not the five header bytes. A frame claiming more bytes than remain is reported as a truncated tail.

Common mistakes

Mistake:Assuming the length includes the five-byte prefix.

Fix:It counts only the protobuf body. The tool computes it for you on encode.

Mistake:Handling a compressed flag by decoding the raw bytes as protobuf.

Fix:Flag 01 means the body is compressed with the method in grpc-encoding; inflate it first, or use a capture that matches the header.

Mistake:Treating int64 IDs as JavaScript numbers.

Fix:Keep IDs above 2^53 as strings; the decoder emits 64-bit integers as strings by default.

Mistake:Pasting a plain string into a bytes field and expecting the literal text.

Fix:bytes fields accept base64 strings such as AQI= or arrays of byte numbers.

Frequently asked questions

What is the 5-byte gRPC prefix?

Every length-prefixed gRPC message starts with one byte that says whether the payload is compressed (00 or 01), followed by a four-byte unsigned big-endian length. That length counts only the protobuf message bytes that follow. The next frame begins immediately after those bytes.

Why does my captured hex fail to decode?

The most common causes are a compression flag of 01 on an uncompressed body, a message type that does not match the capture, or a length that claims more bytes than the paste contains. The tool reports the byte offset, flags truncated tails, and offers a raw wire-field mode when you have no schema.

How are multiple messages framed in a stream?

Each message carries its own flag and length header, and the frames are concatenated with no separator. Decode mode walks from one declared length to the next, so a three-message stream produces three frame cards and stops with an amber truncation warning if the final message is incomplete.

Can it decode fields that are not in my .proto?

Yes. protobuf decoding skips unknown fields, so the tool runs a separate tag walker over the payload and lists field numbers, wire types and raw values that your schema does not declare. That makes version skew between client and server visible. Raw mode lists every field when no schema is available.

Does the compression flag mean the bytes are gzipped?

Not necessarily. In gRPC the flag only says that the sender used the compression method named in the grpc-encoding header; zlib/deflate and gzip are the common choices. The tool sniffs valid zlib and gzip headers and inflates those bodies locally, but it cannot invent a missing header from the bytes alone.

Is my .proto schema or payload uploaded?

No. Parsing, encoding, decoding and compression all happen in your browser tab with protobufjs and platform streams. Nothing is sent over the network and no input is persisted unless you explicitly save it yourself.

References & standards