Protocol Buffer Varint Encoder
Enter an unsigned integer to encode it as a protobuf varint.
Result
How to use
- Enter your values in the fields above.
- Press Calculate to see your result instantly.
- Use the Share button to copy a link to your result.
About this calculator
Protocol Buffers, Google's binary serialization format, encodes integers using base-128 varints to save space on small numbers: each byte carries 7 bits of the value plus a "continuation" bit (the most significant bit) that's set to 1 if more bytes follow and 0 on the final byte. This means small integers — the overwhelming majority in real-world protobuf messages, like field lengths, enum values and IDs — encode in just one byte instead of the four or eight a fixed-width integer would always cost, which is the whole reason protobuf messages stay so compact on the wire.
This calculator takes an unsigned integer and encodes it into its varint byte sequence, showing each byte in both hex and binary so you can see the continuation bits at work. Backend engineers debugging a protobuf wire-format issue, developers writing a custom protobuf parser or serializer without a generated library, and students learning binary encoding schemes use it to manually verify that a value's byte encoding matches what their code produces or expects.
Was this helpful?
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
No calculators found
Comments (0)