Go to Sign up
Note: Your files never leave your device. We don't upload, transfer, or store your data.
|
|
|
|
|---|---|---|
|
|
|
Protocol Buffers (Protobuf) is a language-neutral, platform-neutral serialization format developed by Google. It defines structured data schemas in .proto files, then generates code for 15+ languages.
syntax = "proto3";
package example;
Person {
string name = 1;
int32 age = 2;
string email = 3;
}
| Advantage | Description |
|---|---|
| Compact | Binary format — 3-10x smaller than JSON |
| Fast | Serialization/deserialization faster than JSON/XML |
| Typed | Strong typing with schema validation |
| Cross-language | Generate code for Java, Python, Go, C++, C#, JS, Ruby, PHP, Rust, Swift, Kotlin, Dart, and more |
| Evolvable | Add new fields without breaking old code |
| Schema-first | Contract between services defined upfront |
| Organization | Use Case |
|---|---|
| Internal RPC, data storage, APIs | |
| gRPC | Default serialization format for all gRPC services |
| Kubernetes | API definitions (api.proto, meta.proto) |
| TensorFlow | Model definitions (tensorflow/core/framework/*.proto) |
| Envoy | Configuration and xDS protocol |
| Lyft | Service communication via gRPC |
| Netflix | Edge communication |
| Square | Payment processing |
| Coinbase | Financial data exchange |
| Cortana (Microsoft) | Voice assistant data |
| Feature | proto2 | proto3 |
|---|---|---|
| Syntax | syntax = "proto2"; | syntax = "proto3"; |
| Field presence | Explicit (optional, required) | All fields implicitly optional |
| Default values | No default encoding | Fields with default values not serialized |
| Enums | Open (first value can be anything) | First value must be 0 |
| Extensions | Supported | Replaced by Any |
| JSON mapping | Limited | Built-in support |
| Maps | Supported | Supported |
| Recommendation | Legacy systems only | Default choice for new projects |
syntax = "proto3"; // Required: proto version
package myapp.v1; // Namespace
option java_package = "com.example.myapp.v1";
option go_package = "github.com/example/myapp/v1";
User { // Message definition
int32 id = 1; // Field: type, name, field number
string name = 2;
string email = 3;
bool active = 4;
double balance = 5;
}
enum Status { // Enum definition
UNKNOWN = 0;
ACTIVE = 1;
SUSPENDED = 2;
}
| Type | Description | Default |
|---|---|---|
double | 64-bit floating point | 0.0 |
float | 32-bit floating point | 0.0 |
int32 | Variable-length int (negative inefficient) | 0 |
int64 | Variable-length int64 | 0 |
sint32 | Zigzag encoding (efficient negatives) | 0 |
sint64 | Zigzag encoding (efficient negatives) | 0 |
uint32 | Unsigned int32 | 0 |
uint64 | Unsigned int64 | 0 |
fixed32 | Fixed 4 bytes (efficient > 2^28) | 0 |
fixed64 | Fixed 8 bytes | 0 |
sfixed32 | Signed fixed 4 bytes | 0 |
sfixed64 | Signed fixed 8 bytes | 0 |
bool | Boolean | false |
string | UTF-8 text | "" |
bytes | Arbitrary bytes | empty |
Since CSV is all text, the tool infers protobuf types from values:
| CSV Value Pattern | Inferred Protobuf Type | Example |
|---|---|---|
Integer (42, -7) | int32 | int32 age = 1; |
| Large integer | int64 | int64 timestamp = 2; |
Decimal (3.14) | double | double price = 3; |
true / false | bool | bool active = 4; |
| Any other text | string | string name = 5; |
| Empty / mixed | string | string value = 6; |
Field numbers are assigned sequentially starting from 1, matching column order in the CSV.
| Use Case | Description |
|---|---|
| API migration | Define protobuf schemas from existing CSV data exports |
| gRPC services | Generate .proto files for new gRPC endpoints |
| Data pipeline design | Design schemas for Kafka + Protobuf pipelines |
| Kubernetes CRDs | Define custom resource structures |
| Legacy data migration | Convert CSV exports to typed protobuf messages |
| Documentation | Generate schema docs from sample data |
| Schema prototyping | Quickly draft .proto from real data |
| Database export | Convert SQL CSV dumps to protobuf definitions |
After loading CSV data, an interactive spreadsheet grid lets you edit before converting:
| Operation | Description |
|---|---|
| Transpose | Swap rows and columns |
| Clear | Remove all data |
| Delete Empty | Remove empty rows/columns |
| Deduplicate | Remove duplicate rows |
| Replace | Find and replace (with regex support) |
| Case transform | UPPERCASE, lowercase, Title Case |
| Insert/delete | Right-click for row/column operations |
| First Row as Header | Toggle header treatment |
The tool analyzes CSV cell values and infers the correct protobuf scalar type:
Numeric-only columns → int32 or double
Boolean columns → bool
Text columns → string
All processing runs entirely in your browser. No CSV data is uploaded to any server.
Choose one of two input methods:
Upload a file: Click "Choose File" and select a .csv file.
Paste data: Click "Enter Data" to switch to the code editor. Paste your CSV.
Use the toolbar to clean your data before converting. Remove empty rows, deduplicate, fix casing.
Toggle this ON to use the first CSV row as field names in the generated .proto message.
Click Convert. The .proto schema appears in the "Output Data" panel.
Click Copy to Clipboard to paste into your .proto file.
Premium users can click Download File to save.
Input CSV:
id,name,email,age,active,balance
1,Alice,[email protected],30,true,1250.50
2,Bob,[email protected],25,false,0.00
3,Charlie,[email protected],35,true,9800.75
Output .proto:
syntax = "proto3";
Record {
int32 id = 1;
string name = 2;
string email = 3;
int32 age = 4;
bool active = 5;
double balance = 6;
}
Input CSV:
sensor_id,timestamp,temperature,humidity,location
SENS-01,1714953600,22.5,45.2,Warehouse-A
SENS-02,1714953600,18.3,62.1,Warehouse-B
SENS-03,1714953600,25.0,38.7,Warehouse-A
Output .proto:
syntax = "proto3";
Record {
string sensor_id = 1;
int64 timestamp = 2;
double temperature = 3;
double humidity = 4;
string location = 5;
}
Input CSV:
sku,name,category,price,in_stock,weight_kg
SKU-1001,Wireless Mouse,Electronics,29.99,true,0.08
SKU-1002,Mechanical Keyboard,Electronics,149.99,true,0.85
SKU-1003,USB-C Cable,Accessories,12.99,true,0.05
SKU-1004,Monitor Stand,Furniture,79.99,false,3.20
Output .proto:
syntax = "proto3";
Record {
string sku = 1;
string name = 2;
string category = 3;
double price = 4;
bool in_stock = 5;
double weight_kg = 6;
}
pip install grpcio-tools
python -m grpc_tools.protoc --python_out=. --proto_path=. data.proto
import data_pb2
record = data_pb2.Record(
id=1,
name="Alice",
email="[email protected]",
age=30,
active=True,
balance=1250.50
)
serialized = record.SerializeToString()
print(f"Serialized: {len(serialized)} bytes")
new_record = data_pb2.Record()
new_record.ParseFromString(serialized)
print(new_record.name)
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
protoc --go_out=. data.proto
package main
import (
"fmt"
"google.golang.org/protobuf/proto"
pb "yourmodule/data"
)
func main() {
record := &pb.Record{
Id: 1,
Name: "Alice",
Email: "[email protected]",
Age: 30,
Active: true,
Balance: 1250.50,
}
data, _ := proto.Marshal(record)
fmt.Printf("Serialized: %d bytes\n", len(data)
)
}
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>4.29.3</version>
</dependency>
protoc --java_out=src/main/java data.protoRecord record = Record.newBuilder()
.setId(1).setName("Alice")
.setEmail("[email protected]")
.setAge(30)
.setActive(true)
.setBalance(1250.50)
.build();
byte[] data = record.toByteArray();
System.out.println("Serialized: " + data.length + " bytes");
npm install google-protobuf
npx pbjs -t static-module -w commonjs -o data.js data.proto
npx pbts -o data.d.ts data.js
const messages = require("./data.js");
const record = messages.Record.create({
id: 1,
name: "Alice",
email: "[email protected]",
age: 30,
active: true,
balance: 1250.50,
});
const buffer = messages.Record.encode(record).finish();
console.log(`Serialized: ${buffer.length} bytes`);
const decoded = messages.Record.decode(buffer);
console.log(decoded.name);
| Aspect | Protobuf | JSON | XML |
|---|---|---|---|
| Format | Binary | Text | Text |
| Schema | Required (.proto) | Optional (JSON Schema) | Optional (XSD) |
| Size | Smallest | Medium | Largest |
| Speed | Fastest | Medium | Slowest |
| Human-readable | No (binary) | Yes | Yes |
| Type safety | Strong | Weak | Weak |
| Code generation | Built-in | External tools | External tools |
| Field evolution | Built-in rules | Manual | Manual |
| Best for | RPC, microservices | APIs, web, config | Documents, legacy |
gRPC uses Protocol Buffers as its Interface Definition Language (IDL) and message format:
syntax = "proto3";
package users.v1;
service UserService {
rpc GetUser(GetUserRequest) returns (GetUserResponse);
rpc ListUsers(ListUsersRequest) returns (stream GetUserResponse);
rpc CreateUser(CreateUserRequest) returns (GetUserResponse);
}
GetUserRequest {
int32 id = 1;
}
GetUserResponse {
int32 id = 1;
string name = 2;
string email = 3;
int32 age = 4;
bool active = 5;
double balance = 6;
}
ListUsersRequest {
int32 page_size = 1;
string page_token = 2;
}
CreateUserRequest {
string name = 1;
string email = 2;
int32 age = 3;
}
| CSV Column | Protobuf Field | Notes |
|---|---|---|
User Name | user_name | Lowercase with underscores |
firstName | first_name | Convert camelCase to snake_case |
ID | id | Lowercase |
Price (USD) | price_usd | Remove special chars |
IsActive | is_active | Lowercase with underscores |
created_at | created_at | Already correct |
Protobuf style guide recommends lowercase_with_underscores for field names.
No. All conversion happens locally in your browser using JavaScript. Your CSV data never leaves your device.
Protocol Buffers (Protobuf) is Google's language-neutral serialization format. You define data structures in .proto files, then generate typed code for 15+ programming languages. It is the default format for gRPC.
proto3 is the current default. It has simpler syntax, no required fields, and built-in JSON mapping. proto2 supports required/optional field modifiers and extensions. Use proto3 for new projects.
The tool analyzes cell values in each column. Columns with only integers become int32, decimals become double, true/false becomes bool, and everything else becomes string. Large integers may be inferred as int64.
Yes. Copy the output and modify it. Add package, option, enum, service, repeated fields, oneof, map, and nested messages as needed.
Empty cells are treated as the default value for their inferred type. The field is still included in the message definition.
The tool generates message definitions. To create a full gRPC service, add service blocks with rpc methods manually, using the generated messages as request/response types.
Standard CSV with comma delimiters. Enable "First Row as Header" to use column names as protobuf field names.
Use protoc (the Protocol Buffer compiler):
# Python protoc --python_out=. data.proto # Go protoc --go_out=. data.proto # Java protoc --java_out=src/main/java data.proto # C++ protoc --cpp_out=. data.proto # C# protoc --csharp_out=. data.protoThe tool processes data entirely in your browser. Files up to 10 MB typically convert without issues on modern hardware.