World Library  
Flag as Inappropriate
Email this Article

Torrent file

Article Id: WHEBN0024767575
Reproduction Date:

Title: Torrent file  
Author: World Heritage Encyclopedia
Language: English
Subject: BTDigg, Torrentz, EZTV, KickassTorrents, OpenBitTorrent
Collection: Bittorrent, Computer File Formats
Publisher: World Heritage Encyclopedia

Torrent file

Torrent files
Filename extension .torrent
Internet media type application/x-bittorrent
Standard BEP-0003[1]

In the BitTorrent file distribution system, a torrent file is a computer file that contains metadata about files and folders to be distributed, and usually also a list of the network locations of trackers, which are computers that help participants in the system find each other and form efficient distribution groups called swarms.[1] A torrent file does not contain the content to be distributed; it only contains information about those files, such as their names, sizes, folder structure, and cryptographic hash values for verifying file integrity. Depending on context, a torrent may be the torrent file or the referenced content.

Torrent files are normally named with the extension .torrent, as in MyFile.torrent.


  • Background 1
  • File structure 2
  • Extensions 3
    • Draft extensions 3.1
      • Distributed hash tables 3.1.1
      • Multiple trackers 3.1.2
      • HTTP seeds 3.1.3
      • Private torrents 3.1.4
      • Merkle trees 3.1.5
  • Examples 4
    • Single file 4.1
    • Multiple files 4.2
  • See also 5
  • References 6
  • External links 7


Typically, Internet access is asymmetrical, supporting greater download speeds than upload speeds, limiting the bandwidth of each download, and sometimes enforcing bandwidth caps and periods where systems are not accessible. This creates inefficiency when many people want to obtain the same set of files from a single source; the source must always be online and must have massive outbound bandwidth. The BitTorrent protocol addresses this by decentralizing the distribution, leveraging the ability of people to network "peer-to-peer", among themselves.

Each file to be distributed is divided into small information chunks called pieces. Downloading peers achieve rapid download speeds by requesting multiple pieces from different computers simultaneously in the swarm. Once obtained, these pieces are usually immediately made available for download by others in the swarm. In this way, the burden on the network is spread among the downloaders, rather than concentrating at a central distribution hub or cluster. As long as all the pieces are available, peers (downloaders and uploaders) can come and go; no one peer needs to have all the chunks, or to even stay connected to the swarm in order for distribution to continue among the other peers.

A small torrent file is created to represent a file or folder to be shared. The torrent file acts as the key to initiating downloading of the actual content. Someone interested in receiving the shared file or folder first obtains the corresponding torrent file, either by directly downloading it, or by using a magnet link. The user then opens that file in a BitTorrent client, which automates the rest of the process. In order to learn the Internet locations of peers which may be sharing pieces, the client connects to the trackers named in the torrent file, and/or achieves a similar result through the use of distributed hash tables. Then the client connects directly to the peers in order to request pieces and otherwise participate in a swarm. The client may also report progress to trackers, to help the tracker with its peer recommendations.

When the client has all the pieces, it assembles them into a usable form. It may also continue sharing the pieces, elevating its status to that of seeder rather than ordinary peer.

File structure

A torrent file is a specially formatted binary file. It always contains a list of files and integrity metadata about all the pieces, and optionally contains a list of trackers.

A torrent file is a bencoded dictionary with the following keys:

  • announce—the URL of the tracker
  • info—this maps to a dictionary whose keys are dependent on whether one or more files are being shared:
    • name—suggested filename where the file is to be saved (if one file)/suggested directory name where the files are to be saved (if multiple files)
    • piece length—number of bytes per piece. This is commonly 28 KiB = 256 KiB = 262,144 B.
    • pieces—a hash list, i.e., a concatenation of each piece's SHA-1 hash. As SHA-1 returns a 160-bit hash, pieces will be a string whose length is a multiple of 160-bits.
    • length—size of the file in bytes (only when one file is being shared)
    • files—a list of dictionaries each corresponding to a file (only when multiple files are being shared). Each dictionary has the following keys:
      • path—a list of strings corresponding to subdirectory names, the last of which is the actual file name
      • length—size of the file in bytes.

All strings must be UTF-8 encoded.


A torrent file can also contain additional metadata defined in extensions to the BitTorrent specification.[2] These are known as "BitTorrent Enhancement Proposals." Examples of such proposals include metadata for stating who created the torrent, and when.

Draft extensions

These extensions are under consideration for standardization.

Distributed hash tables

BEP-0005[3] extends BitTorrent to support distributed hash tables.

A trackerless torrent dictionary does not have an announce key. Instead, a trackerless torrent has a nodes key:

'nodes': , , 

The specification recommends that nodes "should be set to the K closest nodes in the torrent generating client's routing table. Alternatively, the key could be set to a known good node such as one operated by the person generating the torrent."

Multiple trackers

BEP-0012[4] extends BitTorrent to support multiple trackers.

A new key, announce-list, is placed in the top-most dictionary (i.e. with announce and info)


HTTP seeds

BEP-0017[5] extends BitTorrent to support HTTP seeds.

A new key, httpseeds, is placed in the top-most list (i.e. with announce and info). This key's value is a list of web addresses where torrent data can be retrieved:

'httpseeds': ['', '']

Private torrents

BEP-0027[6] extends BitTorrent to support private torrents.

A new key, private, is placed in the info dictionary. This key's value is 1 if the torrent is private:

'private': 1

Merkle trees

BEP-0030[7] extends BitTorrent to support Merkle trees. The purpose is to reduce the file size of torrent files, which reduces the burden on those that serve torrent files.

A torrent file using Merkle trees does not have a pieces key in the info list. Instead, such a torrent file has a root hash key in the info list. This key's value is the root hash of the Merkle hash:

'info': {
'root hash': e6bdebcc5d55da0a77f4bb1b57d88de794838577


Single file

Here is what a de-bencoded torrent file (with piece length 256 KiB = 262144 bytes) for a file debian-503-amd64-CD-1.iso (whose size is 647 MiB = 678301696 bytes) might look like:

    'announce': '',
        'name': 'debian-503-amd64-CD-1.iso',
        'piece length': 262144,
        'length': 678301696,
        'pieces': '841ae846bc5b6d7bd6e9aa3dd9e551559c82abc1...d14f1631d776008f83772ee170c42411618190a4'

Note: pieces here would be a 51 KiB value (ceil(length / piece length) * 160 = 414080 bits).

Multiple files

Here is what a de-bencoded torrent file (with piece length 256 KiB = 262144 B) for two files, 111.txt and 222.txt, might look like:

    'announce': '',
        'name': 'directoryName',
        'piece length': 262144,
            {'path': ['111.txt'], 'length': 111},
            {'path': ['222.txt'], 'length': 222}
        'pieces': '6a8af7eda90ba9f851831073c48ea6b7b7e9feeb...8a43d9d965a47f75488d3fb47d2c586337a20b9f'

See also


  1. ^ a b "BEP-0003: The BitTorrent Protocol Specification". Retrieved 2009-10-22. 
  2. ^ "BEP-0000: Index of BitTorrent Enhancement Proposals". Retrieved 2009-10-22. 
  3. ^ "BEP-0005: DHT Protocol". Retrieved 2009-10-22. 
  4. ^ "BEP-0012: Multitracker Metadata Extension". Retrieved 2009-10-22. 
  5. ^ "BEP-0017: HTTP Seeding". Retrieved 2009-10-22. 
  6. ^ "BEP-0027: Private Torrents". Retrieved 2009-10-22. 
  7. ^ "BEP-0030: Merkle hash torrent extension". Retrieved 2009-10-22. 

External links

  • Official BitTorrent Specification
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.