Skip to content
100% local

Protobuf schema to TypeScript types

Turn a Protobuf schema into matching TypeScript interfaces, enums and unions.

Input
Output

Protobuf schema to TypeScript types

Paste a Protobuf schema and this tool generates the matching TypeScript types: one interface per message, one enum per Protobuf enum, and a union type for every oneof. Use it when a .proto file defines an API's wire format and you want a type-safe client without running the full protoc toolchain.

Pick proto2 or proto3 to control how bare fields are read: proto3 implicit presence keeps singular scalar and enum fields always present while message-typed fields stay optional; proto2 instead reads the explicit required and optional keyword on every field. 64-bit integers map to string by default, since JavaScript numbers lose precision above 2^53 — turn the option off for number instead. Repeated fields become arrays and map<K, V> fields become Record<K, V>. A oneof either collapses into a discriminated union type, so only one member can be set at once, or flattens into ordinary optional fields. Nested types keep their nesting in the generated names (Outer_Inner), field names can stay snake_case or convert to camelCase, comments carry over as JSDoc, and turning on service generation adds one interface per Protobuf service with each rpc typed for unary or streaming calls.

The converter is a hand-written parser, not a wrapper around protoc: it covers the everyday shape of a schema — messages, enums, oneofs, maps, nested types and services — while skipping options, extensions and reserved-field statements it doesn't need to reproduce a type. A missing semicolon or an unmatched brace produces a clear error naming roughly where it happened.

Everything runs locally in your browser; your schema is never uploaded, so it's safe to paste proprietary API definitions. Copy the result, download it as a .txt file, or send it back into the input to keep refining the schema.

FAQ

Does it support both proto2 and proto3?
Yes. Pick the syntax option, or leave it as-is: a schema that starts with a syntax = "proto2"; or syntax = "proto3"; line is read from the schema itself and the option only acts as a fallback when that line is missing.
How are 64-bit integer fields handled?
int64, uint64, sint64, fixed64 and sfixed64 map to string by default, because JavaScript numbers cannot represent the full 64-bit range precisely. Turn off "64-bit integers as string" to map them to number instead.
What happens to a oneof group?
With "Represent oneof as a union type" on, a oneof becomes a discriminated TypeScript union so only one member can be set. With it off, each member becomes its own optional field.
Does it generate types for gRPC services?
Turn on "Generate service method types" to add one TypeScript interface per service, with each rpc method typed for a unary call or streaming with AsyncIterable, matching the schema's stream keywords.
Is my schema uploaded anywhere?
No. The schema is parsed and converted entirely in your browser — nothing is sent to a server, so it is safe to paste an internal or unreleased API definition.