← All tools
LEB128 Varint Encoder
Encode and decode LEB128 variable-length integers — the compact byte format behind Protocol Buffers, DWARF debug info, MIDI files, Android's binary format and Bitcoin's CompactSize. Supports Unsigned (ULEB128), Signed (SLEB128 with DWARF sign-extension) and Zig-zag (protobuf sint32/sint64) variants, with full 64-bit range via BigInt. Pure arithmetic, in your browser.
Unsigned expects ≥ 0. Signed & Zig-zag accept negative values. Up to 64-bit range.
High bit of each byte is the continuation flag. The last byte has its high bit clear.