Loading Proto File Validator...
Please wait a moment

How to Validate a Proto File

Step 1

Paste or upload the .proto file

Start with the Protocol Buffer schema you want to check. It can be proto2, proto3 or an editions file.

•
Paste it: copy the .proto from your Connect RPC or gRPC project straight into the editor
•
Upload it: pick a .proto file from your computer
•
Try the sample: Sample loads a small proto3 user service that passes the check, handy for seeing what a clean result looks like

Example: a proto3 file with three mistakes

A missing semicolon on line 15, field number 2 used twice in UserProfile, and an rpc that takes a message nobody defined:

syntax = "proto3";

package user.service;

import "google/protobuf/timestamp.proto";

message User {
  int32 id = 1;
  string name = 2;
  string email = 3;
  repeated string roles = 4;
  bool active = 5;
  google.protobuf.Timestamp created_at = 6;
  UserProfile profile = 7;
  string department = 8
}

message UserProfile {
  string department = 1;
  int32 experience_years = 2;
  repeated string skills = 3;
  string location = 2;
}

service UserService {
  rpc GetUser(GetUserRequest) returns (User);
  rpc UpdateUser(UpdateUserRequest) returns (User);
}

message GetUserRequest {
  int32 id = 1;
}
Step 2

Read the Errors

The checks follow the protobuf language rules that protoc enforces:

•
Syntax: missing ; or }, unclosed strings and comments, a field without a number
•
Field numbers: 1 to 536870911, not 19000 to 19999, no number used twice, nothing that is reserved
•
Types: every message and enum type a field or rpc method uses has to be defined, and google/protobuf types need their import
•
Version rules: proto3 has no required fields or default values, proto2 needs labels, editions use features instead of labels

Example: what the page reports for the file above

The missing semicolon is a syntax error, so it comes first and stops the check:

Line 16, column 1: Missing ";" at the end of field "department" (line 15).

After adding the semicolon, the next run shows the other two:

Line 22, column 21: Field number 2 is already used in "UserProfile" by field "experience_years".
Line 27, column 18: "UpdateUserRequest" is not defined.
protoc reports the same lines; only the wording differs.
Step 3

Fix, Re-check and Share the Report

Change the file in the editor and the check runs again on its own. When it is clean you see the syntax, the package and how many messages, enums, services, fields and rpcs it found.

•
Warnings: imports of your own files that the page can't see, unused google/protobuf imports and a missing syntax line show up in amber; they don't fail the check
•
Report: Copy and Download give you the on-screen report as plain text
•
Style and compatibility: naming style and backward compatibility between versions are not checked here; buf lint and buf breaking do that

Want to tidy the layout too? The Proto File Formatter re-indents a .proto file, and Protobuf to Table shows the messages and fields as a table.

Frequently Asked Questions

What does this validator check?

It reads the file with the same grammar protoc uses and then runs protoc's main checks: syntax (missing ; or }, unclosed strings and comments), field numbers (0, negative, above 536870911, the 19000 to 19999 range kept for protobuf itself, numbers used twice, numbers or names that are reserved), names defined twice in the same scope, unknown message and enum types, map keys that are float, double, bytes, enums or messages, labels inside oneofs and maps, enum rules (first value 0 in proto3 and editions, duplicate numbers without allow_alias), default values that do not fit their type, unknown built-in options and JSON name clashes.

Which syntax versions are supported?

proto2, proto3 and editions 2023 and 2024. The rules change with the version: proto3 rejects required fields, groups, default values and extension ranges, proto2 needs a label on every field, and editions reject the required and optional labels in favour of features.field_presence. A file without a syntax line is read as proto2, the same as protoc, and you get a warning about it.

What about imports of my own files?

The page only sees the file you paste. Imports of the files that ship with protobuf, such as google/protobuf/timestamp.proto or empty.proto, are understood, so a Timestamp field without its import is reported. For an import of your own file (for example common/money.proto) you get a warning instead, and types or custom options that could come from it are not checked. Run protoc or buf on the whole project for those.

Will it give the same answer as protoc?

For a single file it is meant to. We test it against protoc 35 with valid files, broken files and a few hundred one-character changes to valid files, and the verdict and the line of the first error match in nearly every case. The wording of the messages is ours, and protoc can point at a different column for the same problem. Things it does not do: compile code, check option values of custom options, or follow your own imports.

Are large numbers shown exactly?

Yes. The file is never re-printed, and messages quote numbers as you typed them. If you give an int32 field [default = 8901240544102066246], the error says that number with every digit and explains the int32 range. An int64 field with the same default passes.

Is my .proto file uploaded anywhere?

No. The check runs in your browser, the file is not sent to a server and nothing is kept: a reload starts with an empty editor.