What is the TORRENT file format?
Files with the .torrent extension contain metadata - information on other data: files and folders to be distributed within a network based on BitTorrent. They may also include data on trackers - addresses of computers that help locate files within the network. The format is serialized using Bencode, a compact key-value encoding defined in BEP-3.
.torrent files do not contain the data that is going to be downloaded, but instead describe it through a set of fields:
- Name of the file or files to be downloaded, along with its path -
name,path,files - Information on the parts the file will be divided into -
piece length - Total size in bytes -
length - Information about the structure of the directory -
info - A list of SHA-1 hashes calculated for each piece, in order to verify its integrity after download -
pieces - Tracker URL -
announce
The logic of a BitTorrent network is based on decentralising file location, enabling users to establish peer-to-peer connections to download and share data they are interested in. Each downloaded piece is verified against its hash and then shared with other peers in the swarm. Modern clients also support trackerless operation via DHT (Distributed Hash Table, BEP-5), removing the need for a central server. BitTorrent v2 (BEP-52) upgrades piece hashing from SHA-1 to SHA-256. As an alternative to .torrent files, magnet links encode the info hash directly in a URI and have become widely used.
Security & safety
RISK: MEDIUMThe .torrent file itself is plain bencoded text and cannot contain a virus or run code, so the file is safe to open and inspect. The risk lies in what you download with it: torrented content can be malware-laden, mislabelled, or copyrighted. Legality is about content, not the format - downloading a Linux ISO is fine; downloading copyrighted films/software is illegal in most countries. Practical advice: use a reputable open-source client (qBittorrent, Transmission), avoid clients with bundled adware (older Vuze, uTorrent installer offers, BitLord), scan downloaded executables, and be aware your IP is visible to other peers.
Format details
in a nutshellPrograms that open TORRENT files
Technical details
deep spec| Encoding format | Bencode - dictionaries wrapped in `d...e`, integers as `iNe`, byte strings as `length:data`, lists as `l...e` |
| MIME type | `application/x-bittorrent` |
| File signature | No formal magic bytes; files begin with `d` (0x64); tracker torrents typically open with the literal `d8:announce` |
| Piece integrity hash (v1) | SHA-1 - 20-byte hashes for every piece concatenated in the `pieces` field of the `info` dictionary |
| Piece integrity hash (v2) | SHA-256 per-file Merkle tree (BEP-52); 32-byte leaf hashes stored in `piece layers` |
| Typical piece size | 256 KB to 16 MB; always a power of two; fixed at torrent creation and stored in `piece length` |
| Info hash | 20-byte SHA-1 (v1) or 32-byte SHA-256 (v2) of the bencoded `info` dictionary; uniquely identifies the torrent |
| Tracker announcement | `announce` holds a single tracker URL; `announce-list` (BEP-12) extends this to a tiered multi-tracker fallback list |
| Trackerless (DHT) support | `nodes` field lists DHT bootstrap node addresses (BEP-5), enabling download without any central tracker server |
| Private torrent flag | Optional `private` key set to `1` inside `info` disables DHT and Peer Exchange (PEX) for that torrent |
| Multi-file layout | Single-file mode uses a top-level `length` key; multi-file mode replaces it with a `files` list of `{path, length}` entries inside `info` |
| Suggested file name | `name` key inside `info` sets the recommended filename (single-file) or top-level directory name (multi-file) |
| Optional metadata fields | `comment`, `created by`, `creation date` (Unix timestamp), `encoding`, `url-list` (BEP-19 web seeding) |
| Swarm piece exchange | Peers download pieces concurrently; each piece is SHA-verified on arrival before being offered to other leechers |
| Released | 2001 (BitTorrent protocol; BEP-3 metainfo specification) |
| Open standard | Yes · royalty-free |
| Specification | www.bittorrent.org |
TORRENT conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about TORRENT files.