What scalar and composite field types are available in Protocol Buffers?

Last updated 8 July 2026

Protobuf offers a fixed set of scalar types plus composite constructs (messages, enums, repeated fields, maps, and oneofs) that you combine to model structured data.

  • Numeric scalars:

    • Variable-length: int32, int64, uint32, uint64 (varint; inefficient for negatives).

    • ZigZag: sint32, sint64 (efficient for negative numbers).

    • Fixed-width: fixed32, fixed64, sfixed32, sfixed64, float, double.

  • Other scalars: bool, string (UTF-8), and bytes (arbitrary binary).

  • Composite types: message (nested structures) and enum (named integer sets).

  • Collections and unions: repeated for lists, map<K,V> for key/value pairs, and oneof for mutually exclusive fields.

  • Defaults: In proto3 unset scalars take type zero-values (0, "", false); use wrapper well-known types when you must detect presence.

  • https://protobuf.dev/programming-guides/proto3/
  • https://protobuf.dev/programming-guides/editions/
  • https://gripmock.org/guide/types/scalar-types.html
  • https://gripmock.org/guide/types/composite-collection-types.html
  • https://victoriametrics.com/blog/go-protobuf-basic/
  • https://codewithvenu.com/blog/Interview-Tracks/api-Interview/gRPC/02-Protobuf-QA
  • https://prachub.com/resources/grpc-interview-questions-for-backend-engineers-protobuf-streaming-deadlines-and-retries
All gRPC interview questions