Protobuf text format formatter

Paste a message in the Protocol Buffers text format, as TextFormat or a message's toString() prints it or as found in a .txtpb file, to check it and lay it out with consistent indentation. Minify puts it on one line.

The whole text format

  • Fields (name: value) and message blocks with { } or < >
  • Lists [a, b], Any values such as [type.googleapis.com/pkg.Msg], and extension names
  • Comma or semicolon separators, and adjacent strings
  • # comments, kept when formatting together with the blank lines between groups
  • Fields written by number (5: 1), as debug prints show unknown fields and protoc --decode_raw prints every field

Values kept exactly

64-bit integers, octal and Unicode escapes are kept exactly as written.

Convert it to JSON, YAML, XML and more

Convert to shows the message as JSON, JSON5, YAML, TOML, XML or CSV, or makes a JSON Schema for it. A field written twice becomes a list, strings are decoded and 64-bit integers stay exact. As protobuf's own JSON does, a google.protobuf.Struct, Value or ListValue becomes the JSON it holds (in the compact form Go prints too), a map field an object, and an Any its message with "@type".

Folding and field order

Message blocks can be folded. Sort keys orders fields by name, while repeated fields keep their order. Fields written by number come last, in order of their numbers.

Keyboard shortcuts

  • Format: Shift+Alt+F (⌥⇧F on a Mac)
  • Minify: Shift+Alt+M (⌥⇧M on a Mac)
  • Undo: Ctrl+Z (⌘Z on a Mac). Each Format or Minify is a step of its own.
  • Find and replace: Ctrl+F (⌘F on a Mac)

Private: nothing is uploaded

Formatting, checking and comparing all happen in your browser. Your documents are saved in the browser's own storage on this computer, not on a server, so they never leave your device.

With your permission, we count anonymous visits (which pages and tools are used), never what you type. See Privacy.

Questions

What is the Protocol Buffers text format?

A readable way to write a protobuf message, used for configuration files (.txtpb, .textproto, .pbtxt) and printed by TextFormat and a message's toString(). It is different from the binary wire format and from JSON.

Do I need the .proto file?

No. The text is checked against the grammar of the text format, not against a schema, so any message can be formatted without its .proto definition.

Can I convert it to JSON?

Yes, from Convert to above the editor. Without the .proto, the text shows what is a list: a repeated field written only once stays a single value.

Why do some fields have a number instead of a name, like 5: 1?

They are unknown fields. The program that printed the message has a .proto without them (often an older version), so its debug print (Go's String(), Java's toString(), C++ DebugString()) shows their field numbers. They are formatted like any other field, and a badge says how many there are. Parsers such as protoc reject them by default: before parsing the text, print the message again with the current .proto or remove those fields.

Is my data uploaded anywhere?

Your documents aren't: everything runs in your browser, and they are saved on your computer, in the browser's storage for this site. With your permission we count anonymous visits, never their content.

More tools