Home › Developer Tools › Protobuf Decoder

Protobuf Decoder

Paste a Protocol Buffers message as hex or Base64 to see every field number, wire type and value, with nested messages, strings and packed numbers worked out automatically. Add your .proto file to get field names, enum names and correctly typed values.

Last updated:

Schema (.proto) optional, for field names
Advertisement
Advertisement

How to use the Protobuf Decoder

  1. Paste the encoded message as hex or Base64, or upload the raw binary file. The format is detected automatically.
  2. Read the tree: each line shows the field number, the detected type, the value and its byte offset.
  3. Optionally add your .proto in the schema panel and pick the root message to see field names and enum values.
  4. Strip a prefix if the bytes came from gRPC or a length-delimited stream.
  5. Switch to JSON or decode_raw view and copy or download the result.

Protobuf wire types at a glance

Wire typeNameSizeUsed for
0VARINT1 to 10 bytesint32, int64, uint32, uint64, sint32, sint64, bool, enum
1I648 bytes, little-endianfixed64, sfixed64, double
2LENvarint length + datastring, bytes, embedded messages, packed repeated fields, map entries
3SGROUPuntil matching EGROUPproto2 groups (deprecated)
4EGROUPtag onlyend of a proto2 group
5I324 bytes, little-endianfixed32, sfixed32, float

Reading a message by hand

Each field begins with a tag, a varint equal to (field_number << 3) | wire_type. A varint stores 7 bits per byte, least significant group first, and the high bit of each byte says whether another byte follows. Take the bytes 08 96 01:

  • 08 is the tag: 8 >> 3 = field 1, 8 & 7 = wire type 0 (VARINT).
  • 96 01 is the value: 0x96 has the continuation bit set, so take its low 7 bits (0x16 = 22) and add the next byte shifted by 7 (1 × 128). The value is 150.

For a length-delimited field such as 12 07 74 65 73 74 69 6e 67, the tag 0x12 means field 2, wire type 2, and the next varint (7) is the number of data bytes that follow, here the UTF-8 text "testing". Common tag bytes worth recognising: 0a (field 1, LEN), 10 (field 2, VARINT), 12 (field 2, LEN), 18 (field 3, VARINT), 1a (field 3, LEN).

Tips for decoding real-world payloads

  • Base64 from JSON or logs: gRPC-Web, Firebase and many APIs Base64-encode protobuf bytes. Paste them directly; URL-safe Base64 with - and _ also works.
  • Length-prefixed streams: files written with writeDelimitedTo start each message with a varint length. Use the length-delimited skip option for the first message.
  • Negative int32 values are always encoded as 10-byte varints, so a long varint ending in 01 is usually a negative number; check the int64 reading.
  • Floats and doubles: a 32-bit or 64-bit field is shown as a float or double when the value looks like an ordinary number, otherwise as an unsigned integer, with the other reading listed next to it.
  • Proto2 vs proto3: both use the same wire format. Proto3 packs repeated numeric fields by default, and the decoder unpacks them whether or not they are packed.

Frequently asked questions

Can you decode protobuf without the .proto file?

Yes, partly. The binary format stores each field's number and wire type, so the structure, numbers and strings can always be recovered. What is lost without the schema are the field names and the exact types: a varint could be an int32, a bool, an enum or a ZigZag-encoded sint, so the decoder shows the likely readings side by side.

What are protobuf wire types?

Every field starts with a tag that holds the field number and a 3-bit wire type: 0 VARINT (int32, int64, uint, sint, bool, enum), 1 I64 (fixed64, sfixed64, double), 2 LEN (string, bytes, nested messages, packed repeated fields), 3 and 4 start and end group (deprecated proto2 groups) and 5 I32 (fixed32, sfixed32, float). The tag itself is the varint (field_number << 3) | wire_type.

How does the decoder tell a string from a nested message?

A length-delimited field can hold either. The decoder first checks whether the bytes are valid, printable UTF-8 text and shows them as a string; otherwise it tries to parse them as a message and only accepts the result if every byte is consumed by valid fields. If neither works it tries packed varints and finally shows raw bytes. When a string also parses as a message, that is noted so you can check with a schema.

What is ZigZag encoding?

sint32 and sint64 fields map signed numbers to unsigned ones so small negative values stay short: 0 becomes 0, -1 becomes 1, 1 becomes 2, -2 becomes 3, and so on, using (n << 1) ^ (n >> 63). Without it, a negative int32 or int64 always takes 10 bytes as a varint. The decoder shows the ZigZag reading of every varint as "sint".

How do I decode a gRPC message?

A gRPC message on the wire has a 5-byte prefix: one compression flag byte and a 4-byte big-endian length. Choose "gRPC frame" under Skip leading bytes to remove it. If the flag is 1 the payload is compressed (usually gzip) and has to be decompressed before it can be decoded.

Why are 64-bit numbers strings in the JSON output?

The proto3 JSON mapping writes int64, uint64, fixed64 and sfixed64 values as strings, because JavaScript numbers lose precision above 2^53. Without a schema, small varints are written as numbers and larger ones as strings for the same reason.

Is my data sent to a server?

No. The message and the .proto file are parsed by JavaScript in your browser tab. Nothing is uploaded, so you can safely inspect production payloads.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Base64 Encoder DecoderEncode or decode Base64 text and files, and make data URIs.Hex to Text ConverterConvert hex to text and text to hex with UTF-8 support and space, 0x, \x or comma formats.JWT DecoderDecode JSON Web Tokens, read the claims and expiry, and verify HS256 signatures.JSON FormatterBeautify, minify and validate JSON, with a collapsible tree view.Password GeneratorCreate strong passwords and passphrases.Hash GeneratorGenerate MD5, SHA-1, SHA-256 and SHA-512 hashes of text or files.MD5 Hash GeneratorGenerate MD5 hashes of text, lines or files and verify checksums.SHA-256 Hash GeneratorSHA-256 and HMAC-SHA256 hashes of text, lines or files, in hex or Base64.URL Encoder DecoderPercent-encode or decode URLs, query strings and form data.HTML Entity Encoder / DecoderEscape and unescape HTML entities, named or numeric.Bcrypt Hash Generator & CheckerCreate bcrypt password hashes and check a password against a hash.Binary TranslatorConvert text to binary, hex, octal and back.HMAC GeneratorGenerate and verify HMAC signatures with SHA-256, SHA-512, SHA-1 or MD5.CRC32 Checksum CalculatorCalculate CRC-32, CRC-32C, CRC-16 and Adler-32 checksums of text or large files.JWT GeneratorCreate and sign HS256, HS384 or HS512 JSON Web Tokens in your browser and verify them.Password Strength CheckerSee how strong a password really is, how long it takes to crack and how to improve it.Caesar CipherEncode and decode Caesar shift ciphers and crack unknown shifts with a ranked brute force.Vigenère CipherEncrypt and decrypt Vigenère and Autokey ciphers, and crack unknown keys with frequency analysis.Atbash CipherEncode and decode Atbash ciphers (A↔Z, B↔Y) in Latin or Hebrew, with a live letter mapping table.ASCII TableFull ASCII code chart 0–255 in decimal, hex, octal, binary and HTML, with search and copy.Unicode Character LookupFind Unicode characters by name or code point and copy them with UTF-8, HTML and code escapes.Punycode ConverterConvert international domain names, emails and URLs between Unicode and xn-- Punycode, in bulk.JSON Escape / UnescapeEscape text for a JSON string, unescape \n and \" back to text, or stringify a whole object.Binary to HexConvert binary to hex instantly with steps and signed mode.Hex to BinaryConvert hex to binary instantly with steps and signed mode.Binary CalculatorAdd, subtract, multiply, divide, AND, OR, XOR and shift binary numbers with decimal values.Hex CalculatorHexadecimal + − × ÷ and AND, OR, XOR, NOT, shifts with decimal and binary equivalents.Base32 Encoder / DecoderEncode and decode Base32 (RFC 4648), Base32hex, Crockford and z-base-32 from text, hex or files.Base58 Encoder / DecoderEncode and decode Base58 and Base58Check (Bitcoin alphabet) from text or hex, with checksum verification.Unicode Escape / UnescapeConvert text to \uXXXX, \u{...}, \x, &#...; or CSS escapes and decode them back.File Hash CheckerGet MD5, SHA-1, SHA-256 and SHA-512 checksums of files and verify them against a hash.TOTP GeneratorGenerate 2FA one-time codes from a secret key, create otpauth QR codes and verify codes.RSA Key GeneratorGenerate 2048, 3072 or 4096-bit RSA key pairs as PEM, PKCS#1, JWK or OpenSSH, locally.SSL Certificate DecoderDecode PEM SSL/X.509 certificates: subject, issuer, expiry, SANs, key and fingerprints.Text Encryption ToolEncrypt and decrypt text with a password using AES-256-GCM, entirely in your browser.Argon2 Hash GeneratorHash passwords with Argon2id, Argon2i or Argon2d and verify them against an encoded hash.Base64 to PDFDecode a Base64 string to a PDF with preview and download, or encode a PDF to Base64.Bitwise CalculatorCalculate AND, OR, XOR, NOT and bit shifts at 8–64 bits with a bit grid and all bases.Checksum CalculatorCompute 8-bit sum, two's complement LRC, XOR/BCC, NMEA, Fletcher and Internet checksums of bytes.PBKDF2 Hash GeneratorDerive PBKDF2 keys from a password, salt and iteration count with SHA-1, SHA-256 or SHA-512.XML Escape / UnescapeEscape & < > " ' for XML text and attributes, unescape entities back, or wrap text in CDATA.Binary Search Tree VisualizerInsert, delete and find in BST, AVL and red-black trees with animated rotations and traversals.CSR GeneratorCreate a certificate signing request (CSR) and private key with SANs, RSA or ECDSA, in your browser.MongoDB ObjectId to TimestampDecode a MongoDB ObjectId to its creation date, or build ObjectIds from dates for range queries.PGP Encrypt / DecryptEncrypt, decrypt, sign and verify PGP messages with your armored keys, entirely offline.PGP Key GeneratorGenerate an OpenPGP key pair (Curve25519, NIST ECC or RSA) with passphrase and expiry, offline.Quoted-Printable Encoder / DecoderEncode or decode quoted-printable email text (MIME) with UTF-8 and 76-character soft line breaks.Self-Signed Certificate GeneratorCreate a self-signed SSL certificate and key for localhost or dev servers, as PEM or PFX.SHA-1 Hash GeneratorSHA-1 and HMAC-SHA1 of text or files in hex or Base64, plus Git blob hashes and verify.SHA-512 Hash GeneratorSHA-512 and SHA-384 hashes of text or files in hex or Base64, HMAC and hash verification.SRI Hash GeneratorCreate Subresource Integrity hashes (sha256/384/512) and ready <script> or <link> tags.SSH Key GeneratorGenerate Ed25519 or RSA SSH key pairs in your browser: OpenSSH public key plus private key.String Escape / UnescapeEscape or unescape strings for JavaScript, Java, C#, Python, C, SQL, regex, CSV and shell.UTF-8 Encoder / DecoderConvert text to UTF-8 bytes in hex, decimal, binary, \x or % and decode bytes back to text.UUID Decoder & ValidatorDecode any UUID: version, variant, v1/v6/v7 timestamp and MAC node, plus bulk validation.Base64 to FileDecode Base64 or a data URI to a downloadable file; detects the real file type and previews it.File Encryption ToolEncrypt and decrypt any file with a password using AES-256-GCM, entirely in your browser.Passphrase GeneratorMake strong, memorable diceware passphrases from a 7,776-word list, with entropy in bits.CSR DecoderDecode a PEM certificate signing request: subject, SANs, key size, signature and CA readiness checks.Enigma Machine SimulatorEncrypt and decrypt with a virtual Enigma I, M3 or M4: rotors, rings, plugboard and lampboard.Hex Opacity CalculatorConvert opacity percent to a 2-digit HEX alpha code and full #RRGGBBAA color, with a 0-100% table.Playfair CipherEncrypt and decrypt Playfair ciphers from a keyword, with the 5x5 key square and every digraph step.Pwned Password CheckerCheck if a password appeared in data breaches; only 5 characters of its SHA-1 hash are sent.RSA Encryption ToolEncrypt text with an RSA public key and decrypt it with the private key using RSA-OAEP in your browser.SAML DecoderDecode SAMLRequest and SAMLResponse messages to readable XML, attributes and validity times.SSL Certificate ConverterConvert SSL certificates and keys between PEM, DER, PFX/P12 and P7B in your browser.
See all 65 Encoders, Hashes & Crypto →