Skip to main content
Back to Tools
Web Tools

Bencode Encoder/Decoder

Encode JSON to Bencode (BitTorrent's serialization format) or decode Bencode strings back to JSON. Supports strings, integers, lists, and dictionaries with full validation. Runs entirely in your browser — your data never leaves your machine.

encoding bencode bittorrent serialization format

Published May 31, 2026

All interactive tools run entirely in your browser. Your data never leaves your device.

How It Works

In encode mode, enter valid JSON and get the Bencode representation. In decode mode, paste a Bencode string to get formatted JSON output. The tool validates all Bencode rules including sorted dictionary keys, no leading zeros, and proper string length prefixes.

Features

  • Encode mode: convert JSON values (strings, integers, arrays, objects) to Bencode
  • Decode mode: parse Bencode strings into formatted JSON
  • Full validation: checks integer format, string lengths, sorted dict keys, termination
  • Dictionary key sorting: automatically sorts keys in lexicographic order (Bencode requirement)
  • 5 examples: simple string, integer, dictionary, nested list, decode sample
  • Private: runs entirely in the browser — your data never leaves your machine

Use Cases

  • Understanding BitTorrent’s Bencode serialization format
  • Debugging .torrent file contents
  • Protocol education for peer-to-peer networking
  • Converting between JSON and Bencode for development