Pikkola protobuf, tool No. 69

The bytes carry no names.

Paste a payload as base64 or hex. With no schema you get the wire: field numbers, wire types, byte offsets and the bytes behind every length. Add a .proto and the same payload becomes typed JSON, and a JSON document can go back to bytes. The payload stays in the tab.

15
scalar types
4
sample payloads
0
uploads

every sample written and read back by protoc

The decoder

One payload, two readings

The left side holds the bytes and, when you have one, the schema. The right side reads them. Without a schema the tree shows what the wire alone can say. With one, every field gets its name and its type, and the JSON can be edited and written back.

Sample payloads
Payload
.proto schema

Paste a payload, or press one of the samples above.

Nothing leaves the tab

No request, no account, no stored payload. The Content-Security-Policy sets connect-src to none, so the page could not upload a record even if it tried. The interface language and the theme are the only things kept, in localStorage.

Under the decoder

A tag, a wire type, and the length

Protobuf is small because it writes almost nothing that repeats. There is no field name on the wire and no type name, only a number that says which field and how its value is shaped. Everything else is the schema's job.

01

One varint is the tag

A tag is (field_number << 3) | wire_type, written as a varint: seven bits per byte, the top bit saying another byte follows. Field 1 with wire type 0 is the single byte 0x08. The same field with a length is 0x0a.

02

Four wire types carry everything

Zero is a varint: integers, booleans and enums. One and five are eight and four fixed bytes: doubles, floats and fixed integers. Two is a length and then that many bytes: strings, bytes, embedded messages and packed arrays. Groups, three and four, are the deprecated pair.

03

Only length nests

A nested message has no end marker: its length is the only thing that says where it stops. So the tree here follows lengths, not guesses. A length delimited field is offered as text when it is printable UTF-8, as a message when it parses cleanly, and as bytes when neither fits.

The wire types, one by one

What the three bits at the end of a tag can say, and what this page does with each one.

bits type carries read here
0 Varint int32, int64, uint32, uint64, sint32, sint64, bool, enum decimal, plus the signed value when the top bit is set
1 64-bit fixed64, sfixed64, double little endian bytes, the unsigned value and the double
2 Length string, bytes, message, packed repeated length, then text, a message or the raw bytes
5 32-bit fixed32, sfixed32, float little endian bytes, the unsigned value and the float
3 / 4 Group the proto2 group, which is deprecated skipped as a block, with the byte range kept

A tag of 0x00 would be field 0, which protobuf reserves, and it is reported as an error rather than drawn as a field.

Pikkola Watch

The same attention, every morning, without you asking.

This page reads a payload once, when you paste it. Watch reads up to ten domains every day and sends one message when a certificate slips, a page stops answering or a security header disappears.

  • A daily check of every domain, from the edge.
  • A broken redirect, an expiring certificate, a missing header.
  • One message in Slack, Discord or your own webhook.

$7a month

$70 a year, two months free

See what Watch checks

Ten domains, one check a day, $0 to start on this page.

Made by one person, free to use

Questions

What does a protobuf payload actually contain?

A sequence of tags and values. A tag packs a field number and a wire type into one varint, and the wire type says how the value is laid out: a varint, eight bytes, four bytes, or a length followed by that many bytes. No field name and no type name is written to the wire, which is why the same bytes mean different things under different schemas.

Can it decode a payload with no .proto file?

It can give you the structure: field numbers, wire types, byte offsets, the length of every length delimited field, and a reading of the bytes as text or as a nested message. It cannot tell you that field 3 is a customer id rather than a timestamp. Paste the .proto to get the names and the typed values.

Is my payload sent anywhere?

No. The decoder and the schema parser are JavaScript files on this domain, the Content-Security-Policy sets connect-src to none, and the payload is never written to storage. The only things kept are the interface language and the theme.

Which parts of a .proto file are understood?

Messages, nested messages, enums, oneof, map fields, repeated fields, all the scalar types, field options, comments, and both proto2 and proto3 syntax. Imports are not fetched: a type that lives in another file has to be pasted into the same box. Services and extensions are read past because they do not change the bytes.

Why do large integers arrive as strings?

A JSON number holds every integer up to 2^53 exactly and rounds above that. A 64-bit protobuf field can go to 2^63 or 2^64, so a value outside the exact range is written as a decimal string, which is also what the protobuf JSON mapping does. Send it back as a string and it is encoded exactly.

What is the $unknown field in the JSON?

A field number the schema does not name. Rather than dropping it, the decoder lists it with its wire type and its value, so a payload from a newer version of a service does not quietly lose data. The encoder ignores $unknown when it writes bytes back.

What is the gRPC header at the start?

A gRPC message on the wire is a five byte header and then the protobuf message: one byte for the compression flag and four big endian bytes for the length. When those five bytes are present and the length matches, the page says so and offers to skip them. Without that, the first field would be read from the header and the tree would be wrong.

What are the limits?

A payload up to 8 MB, a message nesting up to 64 levels, and 60,000 fields before the walk stops. A .proto up to 512 KB. If a limit is reached the message names it, rather than leaving a partial tree that looks complete.