# What does a torrent file contain? How to read one

*2026-11-07*

> A torrent file contains no film or song. It describes the tracker, file names, sizes and checksums. Here is what each field means.

A torrent file does not contain the film, song or program you want to download. It is a small data file with descriptions: which tracker can help you find other participants, which files are included, how large they are, and a checksum for each piece of the content. What a torrent file contains is set by the BitTorrent specification (BEP 3), which is why nearly all clients use the same fields.

## What a torrent file actually is

A torrent file, sometimes called a metainfo file, is a bencoded dictionary. Bencoding is a simple format that BitTorrent uses to store keys and values in a file. The file ends in .torrent and can be opened in a text editor, but it does not make sense to read without a client or a tool that can decode the format.

The key point is that a torrent file only describes the content. The data itself is downloaded from other participants in the swarm. A torrent file is therefore a map and a list of pieces, not the pieces themselves.

## The fields at the top level

The top level has a few keys. The most important is info, which holds everything that describes the files. Announce is the address of the tracker, a server that answers questions about which other clients have parts of the same content.

Two fields are optional. Creation date is a Unix timestamp for when the file was created. Comment is a free-text note from the creator. Because they are optional, they may be missing, and they say nothing about what the content actually is.

## The info dictionary: name, size and checksums

The info part is the one that counts. It holds three fields that all clients use. Name is a suggested name for the file or folder when it is saved. It is only advisory, so you can rename it without breaking anything. Piece length gives the size of each piece in bytes. According to BEP 3 it is almost always a power of two, and the most common size is 256 KB.

Pieces is a string where each piece is a 20-byte SHA-1 hash. The length of the string is always a multiple of 20, and the number of hashes tells you how many pieces the content is split into. The client compares each downloaded piece with its hash and discards it if it does not match. That is how a client knows that a piece is correct.

## Single-file and multi-file torrents

If the torrent contains only one file, the info part has a field called length, which gives the file size in bytes. If the torrent contains several files, there is a files list instead. Each entry has a length and a path, where path is a list of folder names followed by the file name.

Multi-file torrents treat all data as one long stream in the order the files appear in the list. Pieces therefore do not necessarily follow the file boundaries. A piece can contain the end of one file and the start of the next. This matters when you read the file list: a single file can be split across two pieces, and it is not complete until all of its pieces are.

## Why the info hash is the identity of the torrent

The info hash is the SHA-1 of the info part, in exactly the form it has in the file. It is 20 bytes long and identifies the torrent in the swarm. Two torrent files with different trackers and comments but the same info part get the same info hash and therefore belong to the same swarm. That is why the info hash matters more than the file name.

In practice, if a torrent file has been changed in any field that belongs to the info part, such as a file name, it gets a new info hash and is a different torrent. Changes to announce or comment do not change the info hash.

## Torrent file and magnet link

A magnet link contains the same identity but not the full description. It starts with magnet:?xt=urn:btih: followed by the info hash, and it can also contain a name (dn), trackers (tr) and peer addresses (x.pe). According to BEP 9, a client can use a magnet link to fetch the info part directly from peers, so a torrent file is not needed first.

The difference is therefore in delivery, not in content. A torrent file contains the full description. A magnet link contains the identity, and the client fetches the rest. For more on magnet links, see our guide to [what a magnet link is](/artiklar/vad-ar-en-magnetlank-och-hur-anvander-jag-den).

## How to read a torrent file before you download

Open the file in a client that shows metadata, or in a tool that decodes bencoding. Check the name and the total size first. Do they match what you expect? Then go through the file list. If the list contains many files that do not belong to what you searched for, that is a reason to be careful.

Also check piece length and the number of hashes if you want to understand how large the torrent is. A large number of pieces makes verification longer, but it says nothing about the quality of the content. The only guarantee the torrent file gives is that each piece matches its hash. It says nothing about whether the content is lawful, correctly labelled or free of malicious code.

## Common misunderstandings

The most common misunderstanding is that a torrent file contains the content. It does not, and its comments do not make it better or worse. Another is that a new tracker changes the torrent. The tracker is not part of the info part, so the info hash stays the same and the swarm stays the same.

A third misunderstanding is that a torrent file equals a download. It only describes a download. What actually moves between participants is pieces of data, and a client needs working peers before it can get any pieces at all.

## Frequently asked questions

**Is a torrent file a program?**
No. It is a data file in bencoded format and runs nothing itself. The program that opens it is a client.

**Can I rename a file inside a torrent file?**
You can change the name in the file, but that changes the info hash, because the name is part of the info part. To the swarm it is then a different torrent. Do not edit the file unless you know what you are doing.

For background on how the protocol works, see [BitTorrent explained](/artiklar/bittorrent-protokollet-forklarat).
