Skip to main content

Protobuf Formatter

Format and pretty-print .proto (Protocol Buffers) source — consistent indentation, blank-line spacing between messages/enums/services, aligned enum values, and optional sorting of fields by tag number. Includes basic syntax validation. Runs entirely in your browser.

Input

Output

Formatted protobuf
 
Validation
Issue
No data yet
Was this helpful?

Guides

Paste inconsistently indented .proto source and get back a cleanly formatted Protocol Buffers schema — consistent indentation, blank lines between messages/enums/services, aligned enum values, and an optional sort of fields by tag number. A quick validation pass flags unbalanced braces, an unterminated string or comment, and a missing syntax declaration. Everything runs locally in your browser.

How to use it

  1. Paste your .proto file content.
  2. Choose 2 spaces or 4 spaces for indentation.
  3. Turn on Sort fields by tag number to reorder each message's fields by their tag number (comments stay attached to the field they preceded) — leave it off to keep your original field order.
  4. Check the Validation panel for any syntax issues, and copy or download the formatted result.

What it formats

  • syntax, package, import and top-level option statements, grouped and ordered at the top of the file.
  • message bodies, including nested messages, oneof blocks, map<K, V> fields, reserved and extensions statements.
  • enum bodies, with every value's = aligned to the longest name in that enum.
  • service bodies, with each rpc method (including stream request/response and inline rpc options) on its own block, separated by a blank line.
  • Line (//) and block (/* */) comments — both standalone and attached to the statement they lead or trail.

Does it validate the schema semantically?

No — this checks syntax, not schema semantics. It won't catch a duplicate field tag number, an undefined message type reference, or an incompatible field type change; it flags structural problems (unbalanced braces, an unterminated string/comment) and a missing syntax = "proto2"|"proto3" declaration. For real compilation, use protoc or your language's protobuf compiler.

Is my schema uploaded anywhere?

No. Tokenizing, parsing and formatting all run locally in your browser; your .proto source is never sent to a server.

Need to work with protobuf data instead of the schema file?

Use the Protobuf Text ↔ JSON Converter to convert prototext to JSON and back. For other schema/config formats, see the GraphQL Schema Formatter or the SQL Formatter.

protobufprotogrpcformatterdeveloper

Use it from code

From 3 credits per call

REST API

curl -X POST https://api.iotools.cloud/v1/tool/protobuf-formatter \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "protobufInput": "syntax = \"proto3\";\n\nmessage User {\n    string id…",
    "indentSize": "2",
    "sortFields": ""
  }'

Swap in your own key from your account. The tool's fields are the body — no wrapper.

Ask an AI agent

Use the IOTools `protobuf-formatter` tool (Protobuf Formatter) on this input:

YOUR_INPUT_HERE

Paste this at any agent connected to the IOTools MCP server, then add your input.

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.