A Protobuf Wire Type Is an Instruction, Not a Type (and the Schema Is Where a Number Gets Its Meaning)
Start with the bytes, because the wire type is the one part of the format where people assume the schema is doing work the bytes are not. I took field 1 with the value 1 and wrote it four ways: int32 x=1, bool x=1, uint32 x=1, and an enum where the member ON is 1. All four encode to the same two bytes, 0801. The first byte is the tag, the second is the value. The four .proto files differ only in the type name, and the bytes do not move. That is the whole point of the wire type, and it is easy to miss, because everyone learns that a tag is a field number and a wire type in the same breath and then treats the type as if it were in the tag. It is not. The tag holds the field number and a three bit wire type, and the wire type tells the reader how to read the value, not what the value is. The type name, int32 or bool or enum, is a fact only the .proto knows.
The wire type is three bits, and the spec defines six of the eight possible values. Zero is a varint, so the reader consumes as many bytes as the varint needs. One is an eight byte fixed word, so the reader skips exactly eight bytes. Two is length-delimited, so a length varint comes next and then exactly that many bytes. Five is a four byte fixed word. Three and four are the start and end tags of a proto2 group, which are tags with no payload of their own. Six and seven are reserved, and a decoder that meets either one is reading a corrupted stream. In a proto3 file you will only ever see zero, one, two and five. The wire type is the entire instruction for how to read a value: it fixes how many bytes the reader consumes and how it groups them, and it stops there. It does not say whether the number is signed, whether it is a boolean, or which member of an enum it is. Those are all schema decisions, and the bytes never make them.
Because the wire type is not the type, the raw decode tab, the one that reads bytes with no schema at all, has to guess, and it prints every guess side by side. A varint field reads as varint 5 (unsigned), 5 (signed 64-bit). A four byte field reads as uint32, int32, and a float32 reading of the same four bytes. An eight byte field reads the same way with uint64, int64, and float64. It does not pick one reading, because picking one would be making the schema decision the bytes leave open. The flat list and the tree view disagree on purpose. The flat list labels a length-delimited blob as bytes or a nested message and leaves it at that. The tree view tries to expand it into fields when the bytes parse as a clean run of tag and payload pairs, and falls back to base64 when they do not. This is the surface I repaired this morning: a varint of 2^64-1, which is how a negative int32 is written, used to print as 9223372036854775807, and now prints as -1, the correct two's complement reading. The multiple readings are not a limitation of the tab, they are the point, and they are exactly as far as the bytes allow you to go.
The field number is the other half of the same varint, and it costs bytes the same way the value does. The tag is written as the field number times eight, plus the wire type, and that sum is written as a varint. A field number up to fifteen fits in a single tag byte: field 1 at wire type zero is the single byte 08, and field 15 at wire type two is 0x7a, which is 122. A field number above fifteen needs two bytes for the tag before the value even starts: field 100 at wire type zero is the two bytes a0 and 06, and only after those two bytes does the reader know how many bytes to skip. The lower three bits of that first varint are the wire type, which is why the field number and the reading instruction travel together, and why the reader cannot read the value until it has read the tag.
So the rules. The bytes give you a field number and a three bit wire type, and nothing else. The wire type is an instruction on how to read a value, varint, fixed thirty-two, fixed sixty-four, length-delimited, or a proto2 group, not a statement of what the value is. int32, bool, uint32, and an enum member all wear wire type zero, and all four produce identical bytes for the same number, so only the .proto separates them. A decoder without the schema therefore shows you every reading the wire type allows and lets the schema choose once you have it. You can run it in the tool at proto.datajutsu.com, which has a raw decode tab that works on bytes with no schema at all: put any message in, and watch a single field print its unsigned and signed readings, or its uint and float readings, and watch the tree view expand a nested blob when the bytes allow it. The tag and varint math underneath is in the wire format post, and what happens to the type name once the schema is present is in the JSON mapping post.