What is a .pb file?
Protocol Buffers Binary Data · Data · Google · 2008 (open-sourced)
A .pb file contains data encoded with Protocol Buffers, Google's compact binary serialization. Unlike JSON, the bytes are meaningless without the matching .proto schema that defines the message fields.
What is a .pb file used for?
Protobuf messages are streams of numbered, typed fields with no header and no field names, which is what makes them tiny and fast, and also unreadable on their own: you need the .proto definition to decode field numbers back into names.
That schema-first design powers gRPC APIs and many ML artifacts; TensorFlow graphs and ONNX models are protobuf underneath. A .pb file with no known schema can still be partially inspected with protoc --decode_raw.
How to open a .pb file
The .pb format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list. For a step-by-step walkthrough, see how to open a .pb file.
Windows
- protoc (with the .proto schema)
- Python (protobuf library)
macOS
- protoc
- Python (protobuf library)
Linux
- protoc
- Python (protobuf library)
How to convert a .pb file
You can convert a .pb file to json (via schema), txt (decode_raw) using a conversion tool or the export menu of an app that opens it.
.pb file signature (magic bytes)
Programs recognise a .pb file by the bytes at the start of the file, not by its name. These are the signatures for Protobuf.
| Hex signature | Offset | Note |
|---|---|---|
| (no fixed signature) | 0 | no fixed magic; structure defined by a schema or header |
See the full magic-numbers reference for every format.
Frequently asked questions
What is a .pb file?
A .pb file contains data encoded with Protocol Buffers, Google's compact binary serialization. Unlike JSON, the bytes are meaningless without the matching .proto schema that defines the message fields.
How do I open a .pb file?
With its schema: protoc --decode=package.Message schema.proto < file.pb prints it as text. Without a schema, protoc --decode_raw shows field numbers and raw values.
Why does my .pb file look like random bytes?
By design. Protobuf stores only field numbers and packed values, no names or structure markers, so the .proto definition is required to interpret it.
Is a TensorFlow .pb file the same thing?
Yes at the encoding level: a frozen TensorFlow graph is a protobuf message (GraphDef) saved to a .pb file. TensorFlow tooling, not protoc, is the practical way to load those.
Related formats
Sources
Details on this page were checked against authoritative references: