Don't like ads? Go Ad-Free Today

Bencode Encoder / Decoder

DataDeveloper
ADVERTISEMENT · REMOVE?

Or
ADVERTISEMENT · REMOVE?

Guide

Bencode Encoder / Decoder

Bencode Encoder / Decoder

Encode JSON to Bencode format or decode Bencode back to JSON instantly. Bencode is the serialisation format used by BitTorrent for .torrent files and the DHT protocol. Paste Bencode input to decode it into readable JSON, or paste JSON to encode it into compact Bencode — all client-side with no data transmitted.

How to Use

Select your direction (Bencode → JSON or JSON → Bencode), paste your input, and the result appears instantly. Use the built-in example to see a real .torrent file structure decoded into JSON.

Features

  • Bidirectional conversion – Bencode to JSON and JSON to Bencode
  • Full type support – integers, byte strings, lists, and dictionaries
  • Example preset – real .torrent file structure for reference
  • Real-time output – converts as you type
  • Client-side only – your data never leaves the browser

ADVERTISEMENT · REMOVE?

FAQ

  1. What is Bencode and why does BitTorrent use it?

    Bencode is a simple serialisation format designed for BitTorrent by Bram Cohen. It encodes four types: byte strings (4:spam), integers (i42e), lists (l...e), and dictionaries (d...e). BitTorrent uses it for .torrent metainfo files and DHT messages because it is unambiguous (no encoding ambiguity like JSON has for numbers), compact, and trivial to parse in any language without a library.

  2. How does Bencode encode different data types?

    Bencode encodes integers as ie (e.g., i42e), byte strings as : (e.g., 4:spam), lists as le, and dictionaries as de where keys must be byte strings in sorted order. Nesting is supported arbitrarily. There is no native boolean or float type — booleans are represented as integers (0/1) and floats are typically stored as strings.

  3. What information is inside a .torrent file?

    A .torrent file is a Bencoded dictionary containing: the announce URL of the tracker, an info dictionary with the torrent name, piece length, SHA-1 hashes of all pieces, and either a single file length or a list of files with paths and lengths. Optional fields include announce-list (backup trackers), creation date, comment, and created-by. Magnet links encode a subset of this as a URI.

  4. Can Bencode handle binary data?

    Yes. Bencode byte strings are raw binary sequences prefixed with their byte length. This is why .torrent files store SHA-1 piece hashes as raw 20-byte binary strings rather than hex. When converting Bencode to JSON, binary strings are typically represented as hex or Base64 since JSON has no native binary type.

Want To enjoy an ad-free experience? Go Ad-Free Today

Install Our Extensions

Add IO tools to your favorite browser for instant access and faster searching

Add to Chrome Extension Add to Edge Extension Add to Firefox Extension Add to Opera Extension

Scoreboard Has Arrived!

Scoreboard is a fun way to keep track of your games, all data is stored in your browser. More features are coming soon!

ADVERTISEMENT · REMOVE?
ADVERTISEMENT · REMOVE?
ADVERTISEMENT · REMOVE?

News Corner w/ Tech Highlights

Get Involved

Help us continue providing valuable free tools

Buy me a coffee
ADVERTISEMENT · REMOVE?