Protobuf to TypeScript

Generate TypeScript interfaces from .proto definitions in the browser. Paste a schema, pick a message, and copy the resulting type to use in your codebase.

TypeScript outputNested type supportNo codegen toolchain needed

Skip the protoc toolchain and get TypeScript types in seconds

Setting up protoc with a TypeScript plugin is worthwhile for a long-running project, but it is overhead you do not need when the goal is a single interface for a code review, a quick type check, or a proof-of-concept. This page lets you paste a .proto definition, pick the message, and copy a TypeScript interface without installing any toolchain or leaving the browser.

The generated interface maps protobuf scalars to their TypeScript equivalents — int32 and float become number, bool becomes boolean, bytes becomes Uint8Array, and nested messages become inline interfaces. Repeated fields are emitted as arrays, and optional fields include undefined in their type union so the interface reflects what the wire format can actually produce.

How protobuf types map to TypeScript

Protobuf's type system does not align one-to-one with TypeScript. The int32, uint32, sint32, float, and double types all collapse to number. The int64 and uint64 types map to string by default because JavaScript cannot represent 64-bit integers without precision loss. Enums become TypeScript enums when the schema names them, and oneof groups translate to a union type where only one branch is populated at a time.

Understanding these mappings matters when the generated interface will be used for runtime validation or serialization. If a field is bytes, the interface provides Uint8Array rather than string so downstream code that handles binary data does not need a secondary cast. If a field is a map, the interface emits a Record type that preserves the key and value types from the schema.

When to use generated types versus a full code-generation pipeline

A browser-based generator is ideal for ad-hoc work: reviewing a .proto file someone shared, adding a type to a test file, or creating a quick data transfer object for a prototype. It is not a replacement for a build-integrated pipeline in a production codebase that tracks schema revisions across teams. The practical rule is: if you need one interface right now, paste the schema here. If you need every interface updated on every commit, set up buf or protoc in CI.

The page still saves time even in pipeline-heavy workflows. When you are debugging a type mismatch between a generated client and a server contract, comparing the interface this tool produces against the one your pipeline emits can pinpoint whether the issue is in the schema, the plugin configuration, or the runtime serialization layer.

How does int64 map to TypeScript?

int64 and uint64 are emitted as string because JavaScript's number type cannot represent 64-bit integers without precision loss. Use BigInt wrappers in your runtime code if you need arithmetic on these values.

Does the generator handle nested messages?

Yes. Nested message types are emitted as inline TypeScript interfaces within the parent interface, preserving the hierarchy defined in the .proto schema.

Can I generate types for all messages in a schema at once?

The tool generates the interface for the selected message and any types it references. To cover every message, select each one in turn and copy the output.

Are oneof fields supported?

Yes. Oneof groups are represented as a TypeScript union where each branch includes only its own field, matching the protobuf wire-format rule that at most one field in the group is set.

Do I need to install anything to use this tool?

No. The converter runs entirely in the browser. There is no download, no server dependency, and no build step required.