Protobuf schema to TypeScript types
Turn a Protobuf schema into matching TypeScript interfaces, enums and unions.
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.