Open-source project
webtorrent/webtorrent avatar
webtorrent/webtorrent

WebTorrent: a BitTorrent client that runs inside the browser tab

⚡️ Streaming torrent client for the web

31,393 stars2,901 forksJavaScriptMIT

At a glance

What is it?
WebTorrent ports BitTorrent to JavaScript and swaps TCP/UDP for WebRTC data channels so the same npm package runs in node.js and in Chrome, Firefox, Opera or Safari. The trade-off is a separate peer network: web peers cannot talk to ordinary torrent clients.
Who is it for?
Adopt WebTorrent when you need peer-to-peer file transfer or video streaming inside a page with no plugin, and when your peers are other WebTorrent clients. Do not adopt it if your users must reach the wider BitTorrent swarm, because the README is explicit that a web peer can only connect to clients that support WebTorrent/WebRTC, and that UDP/TCP peers are unsupported in the browser.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 2 days ago.
What is it written in?
Mainly JavaScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

The problem WebTorrent solves is transport, not torrenting

A browser cannot open a TCP socket to a swarm. That single constraint is why BitTorrent never worked on the open web, and it is the constraint WebTorrent attacks. The README states the project is a streaming torrent client for node.js and the browser, written completely in JavaScript so the same code works in both runtimes. In node.js it behaves as a conventional client using TCP and UDP to talk to other torrent clients. In the browser it uses WebRTC data channels as the peer-to-peer transport, with no plugin, extension or installation required. The audience follows from that split. If you are shipping a page that should move files or play a video between visitors without a central file server, this is aimed at you. If you want a full-featured client that reaches the existing public swarm, you are looking at the wrong half of the project.

The protocol change that creates a separate swarm

WebRTC is described in the README as the only P2P transport that works on the web, and to make BitTorrent run over it the project made protocol changes. The consequence is stated plainly: a browser-based WebTorrent client, or web peer, can only connect to other clients that support WebTorrent/WebRTC. The README also notes that WebTorrent does not support UDP/TCP peers in browser. So the browser side is a parallel network rather than a window onto the main one. Seeding into it requires a client that speaks the same dialect, and the README names three: WebTorrent Desktop, a desktop client that can connect to web peers; webtorrent-hybrid, a command line program; and Instant.io, a website. Vuze is cited as an established client that has already added WebTorrent support, so it can connect to both normal and web peers. That is the bridge, and it is a narrow one. The README says the project hopes other clients will follow, which is an honest way of saying the bridge is not yet standard.

Peer discovery, metadata and the extension surface

Discovery is assembled from several of the project's own packages rather than a single mechanism. The README lists dht, tracker, lsd and ut_pex, and magnet URI support comes via ut_metadata. There is also a protocol extension API in bittorrent-protocol for adding new extensions. For anything with a magnet link, ut_metadata is the piece that matters: it is how a client obtains torrent metadata from peers rather than from a.torrent file you already hold. The feature list claims support for magnet URIs, peer discovery through those four channels, and the extension API. It also points at docs/bep_support.md for the full list of supported BEPs, which is the document worth reading before you assume a particular behaviour is implemented. Nothing in the README enumerates the contents of that file, so treat the BEP list as something you verify rather than something this article can summarise.

Files as streams, and what streaming actually buys you

The README says WebTorrent exposes files as streams, fetches pieces from the network on demand so seeking is supported even before the torrent is finished, and switches between sequential and rarest-first piece selection. That combination is the interesting part. Sequential selection suits playback, where you want the next bytes first. Rarest-first suits swarm health, where you want to avoid a piece becoming scarce. A client that moves between the two is trying to serve a viewer and the network at the same time, and the README presents the switch as automatic rather than something you configure. On the browser side the README lists streaming video torrents into a video tag with webm, mkv, mp4, ogv and mov containers, and AV1, H264, HEVC, VP8, VP9, AAC, FLAC, MP3, OPUS and Vorbis codecs. The HEVC entry carries an asterisk in the README, which is the project's own signal that support there is qualified. Browser playback ultimately depends on what the browser can decode, not on what the torrent contains.

Getting it running: two install paths and a CDN script

For node or a bundler, the README gives npm install webtorrent, then import WebTorrent from 'webtorrent'. For a command line program it points at a separate package: npm install webtorrent-cli -g. For a desktop application on Mac, Windows or Linux it points at WebTorrent Desktop. In a plain page you can include webtorrent.min.js from the jsDelivr CDN, or use browserify or webpack with the import form. The README's browser example constructs a client with new WebTorrent(), calls client.add(magnetURI, torrent => { ... }), logs torrent.infoHash, and iterates torrent.files appending file.name to the document body. The seeding example imports drag-drop alongside WebTorrent and reacts to a file being dropped. Those two snippets are the whole of the usage material supplied here; the full API documentation lives in docs/api.md, which the README links but does not reproduce. If you need option names, event names or error shapes, that file is your source, not this article.

Where WebTorrent is the wrong tool

The clearest limitation is also the most consequential: a web peer can only connect to clients that support WebTorrent/WebRTC, and UDP/TCP peers are not supported in the browser. If your content is seeded only by conventional clients, a browser page built on WebTorrent has nobody to talk to until a WebTorrent-capable seeder joins. That inverts the usual assumption that a popular torrent has a healthy swarm. Popularity in the main network does not imply reachability from a web peer. There is a second boundary in the runtime split itself. The npm package is shared, but the transports are not, so a code path that works in node.js against TCP peers may have no equivalent in the browser. And browser support is enumerated as Chrome, Firefox, Opera and Safari, with no version detail in the README, so the matrix is something you test against your own targets rather than assume.

How this differs from a standard torrent client

A conventional client such as Transmission or qBittorrent speaks BitTorrent over TCP and UDP and joins the public swarm directly. WebTorrent in the browser speaks BitTorrent semantics over WebRTC data channels and joins a network of clients that also speak that dialect. The difference is not a feature gap so much as a reachability gap in both directions: the browser client cannot see ordinary peers, and ordinary peers cannot see it unless they have added WebTorrent support. The project's own answer is webtorrent-hybrid, a command line program that can seed to web peers. That is the piece that makes the two networks meet, and it is a separate install from the library. If your goal is to download from the existing swarm, a standard client is the direct route. If your goal is a page that moves bytes between visitors with no server in the middle, WebTorrent is doing something a standard client cannot do at all.

Maintenance, licence and what to check before adopting

The repository is MIT licensed and not archived, and the supplied release list shows v3.0.21, v3.0.20 and v3.0.19 all dated 2026-07-27, with the last push to master on 2026-09-10. Three patch releases inside roughly nine minutes suggests a burst of small fixes rather than a slow trickle, but the README does not say what changed in any of them, so read the release notes before upgrading. The README notes the test suite runs completely offline, which matters for a project whose transports are network-bound: it means CI does not depend on live peers or trackers. On licence, MIT is permissive and places few conditions on reuse, but the README also names third-party sponsors and links to a contributing policy in the webtorrent organisation, so if you are redistributing the bundle, confirm the notices you need to carry. That is a question for your own counsel, not something this article can settle. Practically, the first things to verify are docs/bep_support.md, docs/api.md and whether your seeding side can run webtorrent-hybrid or WebTorrent Desktop, because without one of those the browser client has no one to connect to.

Editorial conclusion

Adopt WebTorrent when you need peer-to-peer file transfer or video streaming inside a page with no plugin, and when your peers are other WebTorrent clients. Do not adopt it if your users must reach the wider BitTorrent swarm, because the README is explicit that a web peer can only connect to clients that support WebTorrent/WebRTC, and that UDP/TCP peers are unsupported in the browser. Before committing, check docs/bep_support.md against the BEPs your content depends on, confirm the browser matrix you must support, and decide whether you will run webtorrent-hybrid, WebTorrent Desktop, or Instant.io on the seeding side.

Official sources

  1. License: MIT
  2. Project website
  3. README
  4. Releases
  5. webtorrent/webtorrent on GitHub
Community notes

Community notes