Skip to content

What is a magnet link, and how does it work?

Understand how magnet links work without .torrent files. Learn how cryptographic info hashes, DHT, and BEP 9 metadata exchange locate peers.

In short

  • A magnet link is a text-based URI that identifies files by their cryptographic content hash rather than a web server location.
  • Unlike .torrent files, magnet links contain no piece lists, retrieving file metadata directly from peers using the BEP 9 protocol.
  • The Distributed Hash Table (DHT, BEP 5) allows torrent clients to find swarm peers without relying on central tracker servers.
  • Magnet links are neutral networking addresses; their legality depends entirely on whether the target media is authorized for sharing.
On this page
  1. What is a magnet link, and what does it look like?
  2. Magnet link vs torrent file: What is the difference?
  3. What is an info hash, and how does it identify a file?
  4. How do magnet links find peers without a central server?
  5. How does metadata exchange work under BEP 9?
  6. How do you stream a magnet link on a Mac?
  7. Are magnet links legal to use?

A magnet link is a text-based web address that identifies a downloadable file by its cryptographic content hash rather than by its location on a specific server. When you click a magnet link, your BitTorrent client or media player uses that unique cryptographic fingerprint to find other computers across the internet sharing the exact same data.

Unlike traditional web links (http:// or https://), which point to a file stored on a single computer or content delivery network, a magnet link points to the content itself. This decentralized approach means a magnet link keeps working even if the website that published it goes offline, as long as people are still sharing the file.

A magnet link is formatted as a Uniform Resource Identifier (URI) that begins with the scheme magnet:?. Instead of specifying a host domain name or a server folder path, it includes a collection of key-value parameters that describe what file you want to download.

The open movie Sintel, produced by the Blender Foundation and licensed under Creative Commons Attribution, is widely shared through public swarms. The magnet link the WebTorrent project uses for its Sintel demo illustrates the core components of the URI:

Try it

Anatomy of a BitTorrent Magnet Link

&

Scheme

Uniform Resource Identifier scheme identifying a magnet link

  1. magnet:?: Scheme. Uniform Resource Identifier scheme identifying a magnet link
  2. xt=urn:btih:: Exact Topic. Prefix indicating a BitTorrent Info Hash URN
  3. 08ada5a7a6183aae1e09d831df6748d566095a10: BTIH Hash. 40-character hexadecimal SHA-1 info hash uniquely identifying Sintel
  4. dn=: Display Name. Parameter key indicating human-readable title
  5. Sintel: File Name. Suggested filename of the media content
A magnet link specifies the cryptographic info hash and optional display metadata rather than a web host.

In this URI, the parameter xt stands for exact topic. It specifies the uniform resource name (urn:btih:) followed by a 40-character hexadecimal string. That string is the BitTorrent Info Hash (BTIH), which serves as the permanent digital fingerprint of the media. The optional dn parameter provides a human-readable display name so your software knows what to label the download before fetching the official file list.

Magnet links can also include one or more tr (tracker) parameters. A tracker is an internet server that maintains a list of IP addresses actively participating in that specific swarm. While trackers help clients find peers faster, modern magnet links can locate peers even when no trackers are provided.

To understand how magnet links changed peer-to-peer distribution, compare them with traditional .torrent metainfo files defined in Bram Cohen’s baseline BEP 3 specification.

A .torrent file is a structured binary file formatted using Bencoding. It contains a complete dictionary of metadata: the exact names and directory paths of every file, the total byte count, the size of each data piece (typically between 256 KB and a few megabytes), a list of tracker URLs, and a continuous series of 20-byte SHA-1 hashes for every individual piece in the archive. Because .torrent files contain this complete catalog, a download client can immediately start requesting piece data the moment the file opens.

However, a .torrent file has to be hosted and downloaded before anything starts. A magnet link removes that step: it is a line of text you can paste anywhere, and the swarm supplies the rest.

Feature .torrent File Magnet Link
File format Bencoded binary file Text-based URI string
Storage requirement Downloaded file on disk (10 KB to 500 KB) Plain text (typically under 200 bytes)
Initial peer lookup Connects immediately using built-in tracker list Queries DHT or trackers using the info hash
Metadata delivery Instant (all file names and piece hashes included) Delayed (must fetch metadata from peers via BEP 9)
Hosting needed A file on a web server or disk None: a line of text in a page, email or chat

With a magnet link, storing and sharing the torrent’s metadata shifts from a web server to the swarm itself.

What is an info hash, and how does it identify a file?

The cryptographic info hash is the foundation of the BitTorrent protocol. It is generated by running the SHA-1 cryptographic hashing algorithm over the info dictionary of a torrent’s metadata.

The info dictionary contains the structural blueprint of the payload: the exact byte lengths, the file names, the piece size, and the raw concatenation of SHA-1 hashes for every piece. Because cryptographic hash functions produce a completely different output if even a single byte changes, the resulting 20-byte info hash is globally unique to that specific file combination.

If two people across the world independently create a torrent from the identical video file, with the same file name, piece size and settings, both torrents generate the exact same info hash. Conversely, if an uploader modifies a single frame of the video or changes an audio track, the info hash changes completely, creating a distinct, isolated swarm.

When your client connects to peers, it uses the info hash to ensure data integrity. As byte blocks arrive, your software hashes them locally and checks them against the verified piece hashes. If data is corrupted in transit or tampered with by a malicious node, the client detects the mismatch, discards the bad piece, and requests it from a different peer.

When you click a magnet link that has no tracker URLs, how does your computer know which IP addresses in the world are sharing the file? It does this through the Distributed Hash Table (DHT), formalized in BEP 5.

The BitTorrent DHT is a decentralized database based on the Kademlia routing algorithm. Instead of storing peer lists on a central server, millions of running BitTorrent clients each store a small portion of the global peer directory in memory. Every client in the DHT is assigned a 160-bit node ID in the same cryptographic address space as torrent info hashes.

When you paste a magnet link:

  1. Your client computes the cryptographic distance (using the XOR metric) between the magnet link’s info hash and the node IDs of clients already in its local routing table.
  2. It sends get_peers queries over UDP to the nodes closest to that info hash.
  3. Those nodes either return the IP addresses of peers actively downloading or seeding that info hash, or they return the contact information of other DHT nodes that are closer to the hash.
  4. Your client repeats this process recursively, zeroing in on the swarm until it connects directly to active peers.

This trackerless discovery system ensures that as long as two computers on Earth are running DHT-enabled software and sharing the same info hash, they can find and connect to each other without third-party servers.

How does metadata exchange work under BEP 9?

Finding peers through DHT solves the connection problem, but a magnet link still lacks crucial information: it does not know what files are inside the torrent, how large they are, or what the cryptographic hashes are for individual pieces. Without this data, downloading cannot begin.

To solve this chicken-and-egg dilemma, the BitTorrent community developed the extension protocol for metadata transfer, defined in BEP 9 (ut_metadata).

Once your client establishes a TCP connection with a peer found via DHT or a tracker, the two clients exchange an extension handshake (BEP 10) declaring what advanced protocols they support. If both support BEP 9, your client requests the torrent’s metadata (its info dictionary) directly from the peer, which sends it in 16 KB chunks.

Once your client has all the chunks, it calculates the SHA-1 hash of the assembled dictionary. If it matches the info hash in your magnet link, the metadata is verified. Your client now knows the file structure and every piece hash, and starts downloading the media.

Most traditional torrent clients require you to download a video file completely to your hard drive before you can watch it. For a 10 GB high-definition video, that means waiting minutes or hours before knowing whether the file plays cleanly.

Because MacLC integrates the libtorrent engine directly into its playback pipeline, it handles the BEP 5 DHT lookup and BEP 9 metadata exchange automatically. When you paste a link, an animated screen explains each step: MacLC waits for about 20 seconds of film to measure the swarm’s speed, builds a buffer of 10 to 90 seconds depending on it, then plays, with a marker on the playback bar showing what is downloaded ahead.

Installing MacLC doesn’t change which app opens magnet links. Torrent clients like Transmission or qBittorrent stay the default when you click a magnet link in your browser, so streaming in the player is always your choice.

A common misconception is that magnet links are inherently illegal. In legal terms, a magnet link is an alphanumeric text string—a cryptographic URI. It is a communication tool, functionally identical to an HTTP hyperlink.

The legality of using a magnet link depends entirely on the copyright status of the file it references and whether you have authorization to distribute that material:

  • Legal uses: academic datasets, open-source software, Linux installation images (such as Ubuntu and Fedora), public-domain archives and Creative Commons films (such as Blender’s open movies) are shared over BitTorrent to reduce hosting costs.
  • Unauthorized uses: Sharing commercial films, television shows, copyrighted music, or commercial software without authorization from the copyright holder violates statutory copyright laws in almost all jurisdictions.

Because the BitTorrent protocol automatically uploads data pieces to other peers while downloading, users who share copyrighted files without permission engage in unauthorized public distribution under copyright statutes like 17 U.S.C. § 106 in the United States. This article is for informational purposes and does not constitute legal advice. To explore the nuances of international copyright enforcement, read our detailed analysis on is torrenting legal.

Magnet links remain one of the most resilient networking technologies created for the open internet. Understanding how they resolve through DHT and how swarms coordinate data makes it easy to explore seeders vs leechers and master how torrent streaming works on your Mac.

Questions people ask

What is the difference between a magnet link and a .torrent file?

A .torrent file is a downloaded file that contains a complete list of piece hashes, file structures, and tracker URLs. A magnet link is a text link containing the 40-character info hash; your player must download the actual file list from peers in the swarm before downloading starts.

What is an info hash in BitTorrent?

An info hash is a 20-byte SHA-1 fingerprint calculated from a torrent's metadata. It identifies the exact contents so that peers can verify they are sharing identical data. (BitTorrent v2 uses a 32-byte SHA-256 hash instead, written with btmh in magnet links.)

How do I play a magnet link on a Mac?

You can copy the magnet link and paste it into a video player that supports peer-to-peer streaming. In MacLC, press ⌘U (File › Open Web Video) and paste the link: playback starts after a short buffer, without waiting for the full download.