Bencode (BitTorrent) encode & decode

Client

Bencode is the binary tree format from BitTorrent: strings with length, integers in i…e, lists, and dictionaries. Enter JSON to emit raw bytes (shown as hex), or paste hex to recover JSON.

Part of encoding tools.

Workspace

One field: use JSON → bencode (hex), or hex → JSON. Output replaces the field.

Bencode (BitTorrent)

?

Bencode is the structured binary format used in torrents: byte strings, integers (ie), lists, and dicts (keys byte-sorted in the wire). JSON here supports bigint via the parser; booleans encode as i0e/i1e (common extension).

After encode, the field shows space-separated hex of raw bytes. Paste that back (or other hex) to decode to pretty JSON. Non-UTF-8 string parts decode with replacement characters in JSON.

Common use cases

  • Inspect a small torrent’s info dict shape by pasting the bencode region as hex (from a hex view).
  • Turn JSON into wire-format bencode for quick comparison with other tools.
  • Round-trip a test object to verify your JSON maps to the expected byte-sorted keys.

Common mistakes to avoid

  • Using JSON null

    Bencode has no null—omit those keys or use a string placeholder; the encoder throws on null/undefined.

  • Expecting binary keys

    This workspace maps JSON string keys to UTF-8; exotic binary keys need a different pipeline.

FAQ

Why is the encoded output shown as hex?

Bencode is a byte format; space-separated hex is easy to copy, paste, and diff without mojibake in the text field.

Does data leave my browser?

No. Parse and encoding run entirely on your device.

Common search terms

Phrases people search for that match this tool. See the full long-tail keyword index.

  • bencode json encode decode online
  • bittorrent bencode to json
  • torrent bencode dict parser browser
  • bencode hex decode online

Related utilities you can open in another tab—mostly client-side.