Filename extension .torrent
Internet media type c706de10d03b7d5c5007692e89418f20e192973d
File formats category - v  e   edit

A torrent file (.torrent file, BitTorrent metainfo file) is required by a BitTorrent client to initiate file transfer using the BitTorrent protocol.


bencoding is a way to store some data structures in the torrent file format.

Strings are stored as <length of string>:<string>:
Integers are stored as i<integer>e:
Lists are stored as l[value 1][value2][value3][...]e. For example, {spam, eggs, cheeseburger} is stored as:
Dictionaries are stored as d[key1][value1][key2][value2][...]e. Keys and values appear alternately. Keys must be strings and must be ordered alphabetically. For example, {apple-red, lemon-yellow, violet-blue, banana-yellow} is stored as:


Data in a torrent file is bencoded as a dictionary, with no other header. Because of the alphabetic-order of dictionary keys, the first seven characters of the file will be "d4infod". The top-level dictionary has the following keys:

Key Type Description
info dictionary File information for the torrent.
announce string The URL of the tracker for the torrent. For example, 29:
announce-list list A listing of the URLs of alternate trackers for the torrent. The URLs are divided into groups (each is a list), trackers in each group may be shuffled, and groups are processed in the order they appear. Optional.
creation date integer The creation date and time, expressed as the number of seconds since January 1, 1970 12:00. Optional.
comment string Any user comment for the torrent. Optional.
created by string Application-generated string that may include its name, version, etc. Optional.

File information (info)Edit

The info key corresponds to the files in the torrent. There are two-forms: a single-file format that contains only a single file, and a multi-file format that may contain multiple files and directories. The info key itself corresponds to a another (essentially "nested") dictionary with the keys as follows:

Common file keysEdit

Key Type Description
piece length integer The number of bytes in each piece. Files in a torrents are divided into "pieces" with a specific length.
pieces string A (byte) string consisting of the concatenation of all 20-byte SHA1 hash values, one per piece.

Single-file format keysEdit

Key Type Description
name string The proposed filename of the file.
length integer The length of the file, in bytes.

Multi-file format keysEdit

Key Type Description
name string The proposed name of directory to store the files.
files list (of dictionary) A list of dictionaries, one dictionary for each file in the torrent, which is described in the next table.

A dictionary in the file list corresponds to one file and contains the following:

Key Type Description
length integer The length of the file, in bytes.
path list (of string) A list of strings representing the relative path to the file. For example, l6:source3:bin8:test.exee corresponds to the path "<directory name>\source\bin\test.exe".


Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.