All Tools View Categories About Contact Privacy

Bencode to JSON

Decode bencode (BitTorrent metainfo, tracker messages) into readable JSON: integers, byte strings, lists and dictionaries. Handles UTF-8, the null marker and duplicate keys. All client-side.

Bencode Input
Waiting for input
JSON Output
Integers i<n>e become numbers, <len>:<bytes> become strings (UTF-8 decoded), l...e become arrays and d...e become objects. The non-standard n marker decodes to null. Malformed input is reported with a position hint.

About Bencode to JSON

A .torrent file, a tracker announce, a DHT message — on the wire they are all bencode: compact strings with length prefixes, integers wrapped in i...e, and deeply nested lists and dictionaries. Reading that by eye is painful, and debugging a peer against a malformed metainfo file is worse.

Convert Bencode to JSON parses bencode into a clean, pretty-printed JSON document. Dictionaries become objects, lists become arrays, integers and strings map onto their JSON counterparts, and UTF-8 strings are decoded for you.

Features

  • Full grammar: Integers, strings, lists, dictionaries and arbitrary nesting.
  • UTF-8 strings: Byte strings are decoded to readable text when valid UTF-8.
  • Torrent files: Upload a .torrent or .bencode file, or paste text.
  • Null support: The common n marker becomes JSON null.
  • Strict validation: Truncated and malformed bencode is reported with a position.
  • Duplicate detection: Dictionary keys that would overwrite are flagged.
  • Pretty output: The result is indented, readable JSON.
  • Private: All parsing happens in your browser.

How to Use

  1. Paste bencode or upload a .torrent file.
  2. Read the JSON — dictionaries, lists and values are decoded instantly.
  3. Check the info section of a metainfo file for files and piece lengths.
  4. Copy or download the JSON document.

Examples

Example 1 — Torrent inspection. A user uploads a .torrent to see the announce URL, file list and piece length in readable JSON instead of decoding hex by hand.

Example 2 — Tracker debugging. A tracker operator pastes a failed announce request and reads the error key that the protocol hides in bencode.

Example 3 — Data migration. A team imports legacy torrent metadata into a JSON database, converting each metainfo file and reviewing the output before ingest.

Example 4 — Testing. A developer generates bencode fixtures for a peer implementation, converts them here, and uses the JSON as expected-output test data.

Benefits

  • Instant readability: Compact bencode becomes indented JSON.
  • Standards-safe: Strict parsing catches truncation and duplicates.
  • No install: Runs in the browser, nothing to download.
  • Round-trip friendly: Pairs with our JSON to Bencode tool.
  • Zero upload: Files are parsed locally, never sent anywhere.

Frequently Asked Questions

What bencode structures are supported?
All of them: integers (i<num>e), byte strings (&lt;len&gt;:&lt;bytes&gt;), lists (l...e), dictionaries (d...e) and nested combinations of these. Strings are decoded as UTF-8 when possible, with raw bytes shown as text otherwise.
How are dictionary keys handled?
Keys are kept as strings in their original order, as they appear in the bencode. Duplicate keys are reported as an error because later definitions would silently overwrite earlier ones.
What about the null marker?
This decoder recognizes the non-standard n marker that some encoders (including our JSON to Bencode tool) emit for JSON null, and converts it back to null. Standard bencode has no null type.
Can I load a .torrent file?
Yes. Use the upload button to pick a .torrent or any .bencode file, or paste the bencode text directly into the input pane. Both paths run the same parser.
What errors are detected?
Unterminated lists and dictionaries, integers that are not digits, string length prefixes longer than the remaining input, unexpected characters and trailing data are all reported with a position hint.
Is my bencode uploaded anywhere?
No. Parsing happens entirely in your browser. Nothing is uploaded, stored or logged.