File Formats
  • Audio
  • Video
  • Images
  • 3D & CAD
  • Documents
  • Data
  • Code
  • System
Data
  • Structured text
  • Binary serialisation
  • Databases
  • Scientific
  • Geospatial
  • Machine learning
  • Messages & calendars
  • Compression
  • Archives
  1. Home
  2. Data
  3. Binary serialisation
  4. PB
.PB
  • Overview

.PB

Protocol Buffers binary data

Introduction

Protocol Buffers is Google’s format for structured data, used inside Google since the early 2000s and open source since 2008. The fields of each message are declared in a .proto schema, and the protoc compiler turns the schema into code that reads and writes the compact binary form.

A file holding one encoded message is commonly given .pb; the Protocol Buffers documentation recommends .binpb. Many larger formats are Protocol Buffers messages underneath, including ONNX models.

Software

  • protoc and the official libraries for C++, Java, Python, Go, C# and more
  • Protoscope, which prints any message as readable text, with or without the schema
  • Buf, a command-line tool for schemas and encoded messages
  • Netron, for machine learning models stored as Protocol Buffers

Structure

An encoded message has no header and no magic number. It is a run of fields, and each field starts with a tag: the field number from the schema shifted left three bits, plus a three-bit wire type saying how the value is stored.

Wire typeNameUsed for
0VARINTintegers, booleans and enums
1I64fixed 8-byte values: fixed64, double
2LENa varint length, then that many bytes: strings, bytes, nested messages, packed lists
3, 4SGROUP, EGROUPstart and end of a group, an old feature no longer used
5I32fixed 4-byte values: fixed32, float

Tags, lengths and integers are varints: seven bits per byte, least significant group first, with the top bit set on every byte except the last. Fixed-size values are little-endian. The field names are not stored, so the schema is needed to give the numbers meaning.

© 2026 fileformats.org About Contact Made by Lewpen