Protocol Buffers Tool
Encode, decode and validate Protocol Buffers messages
Proto Schema
Schema Information
Input
Parse schema and select a message type to generate form fields
Output
Raw Fields
| Field # | Wire Type | Value |
|---|
Protocol Buffers Documentation
What is Protocol Buffers?
Protocol Buffers (Protobuf) is a language-neutral, platform-neutral extensible mechanism for serializing structured data, developed by Google. It is smaller, faster, and simpler than XML and JSON for data serialization.
Key Features
- Language-neutral and platform-neutral
- Smaller and faster than XML/JSON
- Strong typing with schema definition
- Backward and forward compatibility
- Automatic code generation
- Efficient binary encoding
How to Use This Tool
- Enter your .proto schema definition in the schema editor
- Click Parse Schema to validate and parse the schema
- Select the message type you want to work with
- For encoding: Enter JSON data and click Encode
- For decoding: Enter binary data and click Decode
- Use Raw Decode to analyze binary data without schema
Tool Features
Encode
Convert JSON data to Protocol Buffers binary format. Supports form-based input for easy data entry with type validation.
Decode
Convert Protocol Buffers binary data back to readable JSON format. Supports Base64, Hex, and C-style hex input formats.
Raw Decode
Analyze protobuf binary data without schema. Useful for debugging, reverse engineering, or analyzing unknown messages.
Form Input
User-friendly form interface that generates input forms based on your schema. Supports nested messages, enums, and repeated fields.
Proto Syntax Reference
Protocol Buffers uses a simple syntax for defining message types:
syntax = "proto3";
message Person {
string name = 1;
int32 id = 2;
string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
string number = 1;
PhoneType type = 2;
}
repeated PhoneNumber phones = 4;
}
syntax: Specifies the protobuf version (proto2 or proto3)message: Defines a message type with fieldsfield: Each field has a type, name, and unique numberenum: Defines enumeration typesrepeated: Marks a field as repeated (array/list)optional: Marks a field as optional (proto3)
Scalar Types
Protocol Buffers supports various scalar types:
| Type | Description | Default |
|---|---|---|
| int32, int64 | Signed integers (variable-length encoding) | 0 |
| uint32, uint64 | Unsigned integers | 0 |
| sint32, sint64 | Signed integers with ZigZag encoding (efficient for negative numbers) | 0 |
| fixed32, fixed64 | Fixed-width unsigned integers (4 or 8 bytes) | 0 |
| sfixed32, sfixed64 | Fixed-width signed integers (4 or 8 bytes) | 0 |
| float, double | Floating point numbers (32 or 64 bit) | 0.0 |
| bool | Boolean values (true/false) | false |
| string | UTF-8 encoded text strings | "" |
| bytes | Arbitrary binary data | empty |
Wire Types
Protobuf uses wire types to determine how to read values from binary data:
| Wire Type | Meaning | Used For |
|---|---|---|
| 0 | Varint | int32, int64, uint32, uint64, sint32, sint64, bool, enum |
| 1 | 64-bit | fixed64, sfixed64, double |
| 2 | Length-delimited | string, bytes, embedded messages, packed repeated |
| 5 | 32-bit | fixed32, sfixed32, float |
Best Practices
- Use proto3 syntax for new projects - it's simpler and more widely supported
- Keep field numbers stable - never reuse or change numbers for existing fields
- Use meaningful field names that clearly describe the data
- Reserve field numbers 1-15 for frequently used fields (they use 1 byte)
- Use 'repeated' keyword for arrays/lists of values
- Define enums for fields that have a fixed set of possible values
Frequently Asked Questions
What is Protocol Buffers (Protobuf)?
Protocol Buffers is a language-neutral, platform-neutral extensible mechanism for serializing structured data. It works like JSON, but is smaller, faster, and generates native language bindings. It is widely used in gRPC microservices.
How do I use this Online Protobuf Tool?
First, paste your `.proto` schema definition into the editor (or load a sample). Click 'Parse Schema' and select a Message Type. Then you can switch between 'Encode' (JSON → Binary) and 'Decode' (Binary → JSON) modes to process your data.
What is 'Raw Decode' (Decode without Schema)?
Raw Decode allows you to inspect a binary Protobuf message even if you don't have the `.proto` file. It parses the binary structure and displays Field Numbers, Wire Types, and Values, which is incredibly useful for debugging or reverse engineering unknown packets.
Is my data processed securely?
Yes. This tool runs 100% in your browser using JavaScript (protobuf.js). Your schemas, JSON data, and binary data are never sent to our servers, ensuring your sensitive information remains private.
Common Use Cases
- Inter-service communication in microservices (gRPC)
- Data storage and caching
- Configuration files
- Network protocols and APIs
References
Related Tools
JSON Formatter
Format and validate JSON data for improved readability and debugging
Schema to SQL DDL Generator
Convert CSV/JSON data to SQL DDL CREATE TABLE statements with MySQL, PostgreSQL support and auto data type inference
JSON YAML Converter
Convert between JSON and YAML formats with custom indentation and flow/block style support
Base64 Encoder/Decoder
Quickly encode and decode Base64 strings, supporting both text and file conversion
XML Formatter
Format and validate XML data with syntax highlighting
Base Converter
Convert between binary, octal, decimal, and hexadecimal number systems with custom base support (2-36)