XML to Protobuf Converter
Input XML
or drop a file anywhere
Output Protobuf
Your Protobuf appears here as you type.
Paste data to see token savings
Convert XML to Protobuf with our free online converter.
Example: XML input and real Protobuf output
The output below was generated by the same conversion code the converter uses, run on this sample when the page was built.
<catalog>
<book id="bk101">
<title>Designing Data-Intensive Applications</title>
<author>Martin Kleppmann</author>
<year>2017</year>
</book>
<book id="bk102">
<title>The Pragmatic Programmer</title>
<author>Andrew Hunt</author>
<year>1999</year>
</book>
</catalog>catalog {
book {
title: "Designing Data-Intensive Applications"
author: "Martin Kleppmann"
year: 2017
@_id: "bk101"
}
book {
title: "The Pragmatic Programmer"
author: "Andrew Hunt"
year: 1999
@_id: "bk102"
}
}Protobuf output is 16% smaller than the XML input. The same data is 214 characters as minified JSON and 341 as pretty-printed JSON. Sizes are character counts, not tokens: token counts depend on the model's tokenizer (see the tokenizer comparison).
XML to Protobuf: what changes
- Reading XML: Attributes are kept with an @_ prefix (id="bk101" becomes "@_id"), repeated child elements become arrays, and numeric text becomes numbers. A single child element becomes an object, not a one-item array, so the shape depends on how many elements appear.
- Writing Protobuf: Output is Protobuf text format: arrays become repeated fields and nested objects become message blocks. To encode binary Protobuf you still need a .proto schema with matching field names and types, and keys like @_id or opt-level are not valid field names.
About XML
Extensible Markup Language is a verbose but powerful format. Still widely used in legacy systems, SOAP APIs, and document formats.
- ✓Rich metadata
- ✓Namespaces
- ✓Validation schemas
- ✓Legacy support
About Protobuf
Protocol Buffers is a binary serialization format from Google. Extremely compact and fast, but requires a schema definition.
- ✓Very compact
- ✓Fast serialization
- ✓Schema evolution
- ✓Type-safe
Why Convert XML to Protobuf?
Use Protobuf for high-performance internal APIs, microservices communication, or when you need maximum efficiency and have defined schemas.
XML to Protobuf: Frequently Asked Questions
How do I convert XML to Protobuf?
Paste your XML into the editor on json2toon.co. The tool detects the input and produces Protobuf instantly, then you copy the result. Conversion runs entirely in your browser, so nothing is uploaded to a server.
Is the XML to Protobuf converter free?
Yes. Converting XML to Protobuf on json2toon.co is free with no account, signup, or usage limit. A free public API is also available for automated, programmatic conversion.
Why convert XML to Protobuf?
Convert XML to Protobuf with our free online converter.
What should I watch out for when converting XML to Protobuf?
Output is Protobuf text format: arrays become repeated fields and nested objects become message blocks. To encode binary Protobuf you still need a .proto schema with matching field names and types, and keys like @_id or opt-level are not valid field names.
Is my data safe when I convert XML to Protobuf?
Yes. The XML to Protobuf conversion happens client-side in your browser. Your source data stays on your device and is never sent to or stored on a server, which makes it safe for private or sensitive payloads.