Free and public TURN servers: what you get, and how to test one

Free STUN servers are easy to find and fine to use, but free TURN servers are rare, and each comes with a catch: a small allowance of traffic behind an account key, or an open login shared with strangers and no promise it stays up. A TURN server relays every second of a call, so somebody always carries its bandwidth, and before you rely on a free one, test it from the networks your users are on.
This post explains why the two differ, what each kind of free relay gives you, what running your own coturn server takes, and how to check any TURN server in a few minutes.
Why STUN is free and TURN is not
Both kinds of server help a WebRTC call connect, and STUN and TURN servers explains what each does in a call. What matters here is how much each one carries.
A STUN server answers a few small packets at the start of a call, telling each device the public address it is seen from. After that the call no longer needs it. One server can answer a great many devices for very little bandwidth, so several large companies run public STUN servers anyone may use, with no account.
A TURN server is a relay. When two devices cannot reach each other directly, both send their audio and video to it, and it passes them on, for as long as the call lasts. That is real traffic. Say each side of a video call sends 1.5 megabits a second. The relay then sends about 1.35 GB an hour out to the two devices, and takes as much in. An allowance of 10 GB a month is used up by about seven hours of one relayed call.
The calls that need a relay are also the calls you can least afford to lose: people behind office firewalls, on hotel Wi-Fi, or on mobile networks that give a phone a new public port for every new destination. A relay that is down or full fails exactly those.
What kinds of free TURN servers exist
| Kind | What you get | The catch |
|---|---|---|
| Public STUN | Your public address, no account | No relay, so no help for the calls that need one |
| A free allowance | A relay behind an account key, a few GB a month | Gone after hours of video |
| An open relay | A login from a public list | Shared with strangers, no promise it is up |
| Your own coturn | Free software | A server, its bandwidth and upkeep |
A free allowance from a hosted service is the most useful of these for a first test. You sign up, get a key, and your server asks for credentials with it. Read what happens when the allowance runs out. Some services stop relaying, some start billing, and either way your users notice before you do.
An open relay is a TURN server whose username and password are published, in a list or a blog post, so anyone can use them. That is handy for a demo on your laptop and risky for anything else. Every app using the same login shares the same capacity, nobody owes you an answer when it is down, and the owner may close it any day. The TURN specification warns that relays give their users a degree of anonymity and so attract people who want to hide their traffic, and an open relay carries that traffic beside yours.
A login in your page is an open relay too. If you paste a fixed username and password into your frontend, anyone who opens the page can copy them and relay their own traffic on your allowance. Use credentials that expire, made by your server for each user, as shown below.
What a free relay can see
WebRTC encrypts all media. The WebRTC security architecture requires SRTP with keys agreed over DTLS between the two devices, so a TURN server passes packets it cannot read. It still sees which addresses talk to each other, when, for how long and how much. With a relay you don't run, that is the part to weigh, and the part its owner keeps in its logs.
Run your own TURN server with coturn
coturn is a free, open-source TURN server, and the one many teams start with. The software costs nothing, the server and its bandwidth do. A short /etc/turnserver.conf for a server with a public address and a certificate for its name:
listening-port=3478
tls-listening-port=5349
realm=turn.example.com
fingerprint
use-auth-secret
static-auth-secret=a-long-random-secret
min-port=49152
max-port=65535
cert=/etc/letsencrypt/live/turn.example.com/fullchain.pem
pkey=/etc/letsencrypt/live/turn.example.com/privkey.pem
no-multicast-peers
denied-peer-ip=10.0.0.0-10.255.255.255
denied-peer-ip=172.16.0.0-172.31.255.255
denied-peer-ip=192.168.0.0-192.168.255.255
denied-peer-ip=169.254.0.0-169.254.255.255What each part is for:
- The ports. 3478 over UDP and TCP is the usual port, and 5349 the usual one for TLS. Networks that let only the web out need TLS on 443, so set
tls-listening-port=443if nothing else on the server holds it. The relay itself uses the range frommin-porttomax-port, which the firewall must open over UDP. The ports a video call needs lists what each kind of network allows. - The secret. With
use-auth-secret, coturn takes no fixed passwords. Your server and coturn sharestatic-auth-secret, and your server makes a login for each user that stops working at a time it chooses. - The denied ranges. A relay forwards to the addresses it is asked to, so without lines like these a user with a valid login could reach machines on the server's private network. Add the ranges of any other private network the server is on. The specification allows a server to refuse any range of peers, and private ones should be refused.
- A server behind NAT, as on many cloud hosts, also needs
external-ipset to its public address, or it hands out relay addresses nobody can reach.
Your server makes each login like this, in Node.js, the username being the time it expires and the user, and the credential an HMAC of it with the shared secret, as coturn describes:
import crypto from 'node:crypto';
export function turnCredentials(userId: string, secret: string, ttlSeconds = 6 * 3600) {
const expires = Math.floor(Date.now() / 1000) + ttlSeconds;
const username = `${expires}:${userId}`;
const credential = crypto.createHmac('sha1', secret).update(username).digest('base64');
return { username, credential };
}Hand the result to the signed-in user only, with the addresses of your relay, and the browser puts them in its iceServers. A coturn server answers STUN as well, so it can be your STUN server too.
One relay is a start, not the end. Users on another continent want one near them, and each relay needs updates, a renewed certificate, watching and room to grow. Connecting users across regions shows what that takes.
How to test a free TURN server
Whichever relay you choose, check it before your users do:
- Open the TURN server test.
- Enter each address the relay offers, one per line, with the username and credential. For an expiring login, make a fresh one first.
- Run it, and look for two things: a relay address coming back, and data passing through it. A relay that hands out an address but carries nothing probably has its relay ports closed, or sits behind NAT without its public address set.
- Run it again from a phone on a mobile network, and from the strictest network you can find. The WebRTC test shows what that network allows with no server of yours involved.
How to test a TURN server goes through each result and what errors 401, 486 and 701 mean. To check by hand, set iceTransportPolicy: 'relay' in a test RTCPeerConnection, so the browser gathers only relay candidates and none of the direct ones that would hide a broken relay:
const pc = new RTCPeerConnection({
iceServers: [{
urls: 'turn:turn.example.com:3478?transport=udp',
username: 'your-username',
credential: 'your-credential',
}],
iceTransportPolicy: 'relay',
});
pc.onicecandidate = ({ candidate }) => candidate && console.log(candidate.type, candidate.address);
pc.createDataChannel('test');
pc.createOffer().then((offer) => pc.setLocalDescription(offer));A candidate of type relay means the relay logged you in and gave you an address. When calls still fail after that, our guide to a WebRTC connection that failed finds the cause from both sides.
How WordPlus Cloud relays calls
The relays of WordPlus Cloud are not a free TURN server, and not one you point your own WebRTC code at. They carry the calls made with our SDKs and in Better Messages, as one part of connecting them:
- A call goes straight between the two devices when the networks allow it.
- When a firewall blocks that, each device uses the relay nearest to it, in one of our regions. The relays answer on 3478, on 443 over UDP and TLS, and on 80 over TCP, so a call gets through wherever websites do.
- When even a relay cannot carry it, the call moves into a room on our media servers and goes on, without hanging up.
Each person in each call gets relay credentials of their own, which expire after a few hours, so nobody can use the relays outside your calls. Calls between two people are encrypted end to end on every path, with a key only your server gives out, so the relays carry what they cannot read. They are in every plan, relayed or not, with no credits and no traffic counted, as what video calls cost per minute works through. How calls work in our docs shows the code, and your server still decides who may call whom.
Calls that connect, with no relay to run
WordPlus Cloud for Apps is priced by concurrent connections, starting from 1,000: $11.99 a month billed yearly, or $14.99 billed monthly. See video calls and group calls for your app, the apps pricing, or Better Messages on WordPress for a site that wants calls today. Questions about your network? Write to us.