Protobuf to TypeScript Converter
Paste a .proto schema. Get TypeScript interfaces with proper types, including 64-bit ints as strings per the proto3 JSON mapping spec.
Input (.proto schema)
Output (TypeScript)
Paste your Protobuf on the left and the TypeScript code shows up here.
Or drop a file on this box, , or .
What this tool does
Your web app calls a backend whose messages are defined in Protocol Buffers, usually through gRPC-Web, Connect, or a gateway that turns the calls into JSON over HTTP, and you want TypeScript types for the responses. Proper codegen with ts-proto or protobuf-ts means a protoc binary, a plugin and a build step in the frontend repo. If you are still at the stage of typing a couple of fetch calls, paste the .proto here and copy the interfaces.
Type mapping follows what hand-rolled types look like in real codebases: string/bytes → string/Uint8Array, bool → boolean, the smaller numeric types (int32, uint32, float, double) → number, and the 64-bit integer types (int64, uint64, fixed64, sfixed64, sint64) → string to match the proto3 JSON mapping spec. repeated T becomes T[], map<K, V> becomes Record<K, V>, and a nested message becomes an interface of its own, declared at the top level ahead of its parent (TypeScript has no nested interfaces).
Property names are camel-cased the same way the proto3 JSON encoder does it by default, so shipping_address arrives as shippingAddress and the interface matches the payload key for key. Each enum turns into a union of its value names, for example type OrderStatus = 'ORDER_STATUS_PENDING' | 'ORDER_STATUS_PAID' | ..., which compiles away completely, unlike a TypeScript enum. A google.protobuf.Timestamp field is typed string, the RFC 3339 text JSON gives you, so wrap it in new Date() where you need a date.
How to use it
Three steps. Output is ready to paste into a .ts file in seconds.
Paste your .proto schema
Paste the .proto on the left or bring a file in with Upload; the interfaces on the right refresh a moment after you stop typing. RPC definitions inside service produce nothing, so you get message and enum types only. Types imported from another file are referenced by their bare names without a declaration, which tsc will report as Cannot find name until you paste those messages in too.
The casing changes only on fields: customer_name is written as customerName. Interface names keep the message name, and the enum union keeps the constant names in upper case, exactly as the server spells them in JSON.
Read the output
On the right: TypeScript with export interface for each message and export type with a string-literal union for each enum. Nested types come before their parent so the file is in declaration order. Add the file to your project and import the interfaces from your gRPC client or fetch handler.
Use the types
Wire the interfaces to your fetch / gRPC-Web / Connect-RPC client. The shape matches the proto3 JSON encoding, so JSON responses parse straight into the typed shape without manual conversion. Adjust int64 handling if your server uses non-standard JSON encoding.
When this actually saves time
Sketching types for a new gRPC frontend
You are building a new TS app on top of an existing gRPC service. You do not need full codegen yet, just the interface shapes for typing your fetch calls. Paste the .proto, drop the output in types.ts, you are typed.
Reviewing a Protobuf API change
The backend team changes total_amount from double to int64 to store cents. In proto that looks harmless; in the JSON your app receives, the value turns from a number into a quoted string. Paste the new schema and the interface shows totalAmount: string, which tells you every toFixed(2) call on it is about to break.
Cross-checking generated types
Your build uses protobuf-ts or ts-proto, which produce types with their own conventions. Paste the schema here for a clean reference of what plain TS interfaces look like, useful for documentation or migration planning.
Throwaway scripts and one-off integrations
You are writing a quick Node script that POSTs JSON to a gRPC-gateway. Setting up the full Protobuf toolchain for a 30-line script is overkill. Grab the interfaces from here and you have type safety without the ceremony.
Common questions
Is my schema sent anywhere?
No. The proto is parsed and the interfaces printed by script that runs in this tab, so the schema stays on your machine. Frontend repos often pull in protos from private backend repositories, which is exactly when that matters.
Why are int64 fields typed as string?
JavaScript Numbers are IEEE-754 doubles, which lose precision above 2^53. The official proto3 JSON mapping requires int64, uint64, fixed64, sfixed64, and sint64 to be encoded as JSON strings. So the TS interface uses string for those: matching what your server actually sends. If you need bigint instead, find-replace in the output.
Why are enums string unions instead of TS enums?
Most TypeScript projects prefer string-literal unions over TS enums these days, no runtime cost, better tree-shaking, and they match the proto3 JSON encoding (which serialises enums as their string name). If you want a const enum or a numeric enum, the conversion from the union is mechanical.
How does it handle map<K, V>?
Renders as Record<K, V>. Protobuf maps with non-string keys (e.g. map<int32, string>) become Record<number, string>. JSON only has string keys, so at runtime the keys will be strings even if the proto says int: this is a quirk of the proto3 JSON spec, not the converter.
Are fields marked optional?
No, every field is required in the interface. That is easy to work with but stricter than the wire: by default a proto3 JSON encoder leaves out any field that holds its default value (empty string, 0, false, empty list), and an unset message field is missing too. If your payloads come from such an encoder, add ? to the fields that can be missing, or turn on the encoder's option to always print default values.
Does it handle oneof?
Each member of the group becomes a separate required property, so oneof target { string user_id = 2; string team_id = 3; } produces userId: string; and teamId: string;. In proto3 JSON only the member that was set appears in the payload, so a more honest type is { userId: string; teamId?: never } | { teamId: string; userId?: never }. Rewrite the generated lines into that shape if the compiler should enforce it.
Related tools
After the interfaces, these help close the loop: validate the .proto itself, look at the JSON a message turns into, or start from a real JSON response and get TypeScript from that.