How to Validate a Proto File
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.
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;
}Read the Errors
The checks follow the protobuf language rules that protoc enforces:
Example: what the page reports for the file above
The missing semicolon is a syntax error, so it comes first and stops the check:
After adding the semicolon, the next run shows the other two:
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.
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.