TXT · Text & Data tools

Bencode Decoder

Input encoding
Indent
Or load a file
Encoded bytes
Decoded
Bencodeformat0 Binput0lines out0chars out
Open the full binary format decoder with every format and the encoder

Shareable link

Settings are written to the URL as you change them. Nothing differs from the defaults yet.

Four types, no ambiguity

Bencode has integers, byte strings, lists, and dictionaries, and nothing else. d3:cow3:moo4:spam4:eggse decodes to {"cow": "moo", "spam": "eggs"}.

There is no float, no boolean, and no null. A torrent’s private flag is the integer 1, and a missing key is how absence is expressed.

Why keys are sorted

Dictionary keys must appear in sorted byte order, which makes the encoding canonical: the same data always produces the same bytes. That is what allows the infohash, a SHA-1 over the encoded info dictionary, to be a stable identifier for a torrent.

Re-encoding a decoded torrent with keys in a different order changes the infohash and produces a different torrent.

Strings are bytes

A bencoded string is a length and raw bytes, with no encoding declared. Text keys decode as UTF-8 here, and anything that is not valid UTF-8 falls back to hex, which is what the pieces field does.

Frequently Asked Questions

Yes. Load the file and the announce URL, creation date, comment, and info dictionary are decoded. Choose the file picker rather than pasting, since a torrent contains raw binary hashes.

The pieces field is a concatenation of 20-byte SHA-1 hashes, not text. It renders as hex and is truncated past 64 bytes.

Integers as i42e, byte strings as a length, a colon, and the bytes, lists as l...e, and dictionaries as d...e with keys sorted.

Pages locked to one format

Full Binary Format Decoder tool

Explore Our Tools

Browse all tools