LEB128 (ULEB + SLEB)
ClientLEB128 encodes integers in 7-bit groups with a continuation bit—little-endian. ULEB (unsigned) is for non-negative values; SLEB (signed) uses two’s-complement and sign extension on the last chunk (same model as WebAssembly and LLVM SLEB). Use decimal lines to encode, or a hex/byte bytestream to decode a sequence of LEBs.
Part of encoding tools; raw bytes: hex.
Workspace
Match ULEB vs SLEB to your format; decodes the whole buffer as a chain of LEBs.
LEB128 (ULEB + SLEB)
?
ULEB = non-negative; SLEB = two’s-complement, same wire style as WebAssembly / LLVM. Encode one integer per line(optional # comment on each line); multiple lines also show a concatenated stream.
Decoding reads consecutive LEBs from the stream until the buffer ends—same as a varint or WASM opcode operand sequence.
Common use cases
- Check wasm opcode or DWARF LEB fields against a known decimal, or the reverse, without leaving the tab.
- Inspect concatenated LEBs the same way a byte parser would, one value per drain of the LEB state machine.
- Use ULEB for non-negative only; switch to SLEB for signed, two’s-complement wire form.
Common mistakes to avoid
Mixing ULEB and SLEB on the same bytes
The unsigned and signed encodings of the same bit pattern are different. Pick the mode that matches the producer (WASM, proto3 varint, etc.).
Assuming 32-bit wrap
This tool uses BigInt; values can be larger than 2^32 minus one when the byte length allows a legal LEB.
Odd-length hex by accident
Hex decode expects full bytes (two nybbles per byte). For odd-length paste, add a leading zero to the first byte only if you really mean a half byte.
FAQ
Is this exactly WebAssembly or Protobuf varint?
ULEB and SLEB follow the same little-endian, 7-bit-hunk LEB family used in WASM and in many binary formats. Protobuf’s varint is unsigned; always pick ULEB for those unless your docs call for signed (SLEB).
What is the 624485 example?
It is a common ULEB-32 test vector: decimal 624485 encodes to three bytes e5 8e 26 (shown here as e58e26 in hex with no 0x).
Is data sent to a server?
No. All work happens locally in the page.
Common search terms
Phrases people search for that match this tool. See the full long-tail keyword index.
- leb128 encode decode online
- uleb128 sleb128 wasm varint
- protobuf leb little endian base 128
- dwarf uleb128 decode
More tools
Related utilities you can open in another tab—mostly client-side.
Encoding tools
ClientHub index: Base64 & URL, Base64url, Base32, Crockford, LEB128, ASCII85, Z85, Base58, base-36, bencode, Morse, quoted-printable, URI, Punycode/IDN, Unicode escapes, data URLs, MIME, hex, HTML entities, JWT, JSON helpers, crypto.
Hex encode & decode
ClientUTF-8 text to hex and hex to text—strip spaces, local only.
Crockford Base32
ClientDouglas Crockford Base32 for UTF-8—no = padding, O→0 and I/L→1 on decode; not RFC 4648 Base32.
Z85 encode & decode (ZeroMQ)
ClientZ85 per RFC 32—4-byte big-endian to 5 string-safe characters; not Adobe ASCII85; browser-only.