DevTools Logo

STUN/TURN URL Builder

STUN/TURN URL Builder

Assemble RFC 7065 ICE server URLs, generate coturn ephemeral credentials, and inspect pasted TURN configs — entirely in your browser.

Runs in your browser
Try an example

Server & credentials

TURN (plain)
Credentials

Secrets and credentials stay in this tab's memory. Only non-secret builder options are saved locally or included in a share link.

Generated ICE servers

1 URL
No port given: turn: uses the conventional port 3478.
turn:turn.example.com:3478?transport=udp

Details

Enter a host, port and scheme to get canonical RFC 7065 ICE server URLs (stun:host:3478, turn:host:3478?transport=udp, turns:host:5349?transport=tcp) plus a ready-to-paste RTCPeerConfiguration snippet. Choose Ephemeral to mint coturn REST credentials: the username is the unix expiry plus an optional label, and the password is base64(HMAC-SHA1(static-auth-secret, username)) computed locally with Web Crypto. The Analyze tab decodes multi-line URL lists, iceServers JSON and coturn config excerpts (including static-auth-secret and external-ip) into per-URL verdicts and an advisory config summary. Secrets are never uploaded, saved to localStorage or included in share links.

More examples

Canonical TURN URL with both transports

turn:turn.example.com:3478?transport=udp
turn:turn.example.com:3478?transport=tcp

RFC 7065 ICE URIs have no // after the scheme. Production configs publish both transports so ICE can try UDP first and fall back to TCP.

coturn ephemeral credentials

username: 1700003600:alice
credential: r3/+T8tUbJcyVnZU4vwqMY0eoNE=
(secret: demo-secret, TTL 3600 seconds)

The username is the expiry timestamp and label; the password is base64 of HMAC-SHA1 over the auth secret and that username, matching coturn's use-auth-secret verification.

Copy into RTCPeerConnection

const rtcConfiguration = {
  iceServers: [
    {
      urls: ["turn:turn.example.com:3478?transport=udp"],
      username: "1700003600:alice",
      credential: "r3/+T8tUbJcyVnZU4vwqMY0eoNE=",
    },
  ],
}

Strings are JSON-escaped, so quotes or backslashes in a label or credential cannot break the generated JavaScript.

Examples

Dual-transport TURN with ephemeral credentials

Input
scheme=turn · host=turn.example.com · credential=ephemeral
secret=demo-secret · ttl=3600 · label=alice
Output
turn:turn.example.com:3478?transport=udp
turn:turn.example.com:3478?transport=tcp
username: 1700003600:alice
credential: r3/+T8tUbJcyVnZU4vwqMY0eoNE=

One username and password authorise both URLs; the password is HMAC-SHA1 over the secret and the timestamped username.

Canonical STUN plus TURN over TLS

Input
scheme=turns · host=turn.example.com · port=(blank) · omit default port=on
Output
turns:turn.example.com

With canonical ports on, the conventional 5349 port is omitted; turns: still uses TLS over TCP.

Analyzing a coturn config

Input
realm=example.com
listening-port=3478
tls-listening-port=5349
fingerprint
use-auth-secret
static-auth-secret=demo-secret
external-ip=203.0.113.5/10.0.0.5
Output
mechanism: ephemeral
derived: turn:203.0.113.5:3478?transport=udp
         turns:203.0.113.5:5349?transport=tcp
note: use the public side of external-ip in client URLs

The scanner reads coturn key=value lines and derives advisory URLs; the discovered secret can be loaded into the generator without retyping it.

About this tool

STUN/TURN URL Builder assembles ICE server URLs for WebRTC in the canonical RFC 7065 form: stun:host:3478, turn:host:3478?transport=udp and turns:host:5349?transport=tcp. There is no // after the scheme, because these are not hierarchical HTTP-style URLs. The tool also emits a ready-to-paste rtcConfiguration snippet with correctly escaped strings.

For self-hosted coturn servers it can mint ephemeral credentials exactly as the REST (use-auth-secret) scheme defines: username = unix expiry plus an optional label, password = base64(HMAC-SHA1(static-auth-secret, username)), computed with Web Crypto in the browser. The Analyze tab decodes pasted URL lists, iceServers JSON and coturn config excerpts into per-URL verdicts and an advisory config summary. Secrets are never uploaded, persisted or included in share links. For session descriptions use the WebRTC SDP inspector; for database DSNs use the database connection string builder instead.

What this tool does not do

  • This is an offline builder and parser: it does not send STUN binding requests or verify that a TURN relay is reachable.
  • Ephemeral signing relies on the browser's clock; an offset larger than the credential lifetime will make generated credentials invalid.
  • SHA-1 appears here only because coturn's REST scheme specifies HMAC-SHA1; it is not a general hash recommendation.
  • The coturn parser is a key=value scanner for common options, not a full config validator; derived URLs are advisory and may need a public hostname.
  • iceServers paste reading accepts JSON (and JSON-like arrays with double-quoted strings), not arbitrary JavaScript expressions.
  • Static credentials are shown only in the generated snippet; they are never placed in a URL or saved locally.

How to use this tool

  1. Choose a scheme

    Pick stun:, turn: or turns:. Ports default to 3478 for stun/turn and 5349 for turns.

  2. Enter host and options

    Type the hostname or a bracketed IPv6 literal, optionally set a port, transport, canonical-port and dual-transport options.

  3. Pick credentials

    Choose none, manual username/credential, or ephemeral: enter the coturn auth secret, TTL, user label and separator to generate signed sets.

  4. Copy the config

    Copy the URL list or the RTC configuration snippet into your signaling layer or RTCPeerConnection constructor.

  5. Analyze a paste

    Switch to Analyze to decode URLs, iceServers JSON or a coturn config excerpt; load a discovered secret back into the builder in one click.

Use cases

WebRTC wiring

Produce the exact iceServers array a signaling server or client app needs, without hand-writing URI punctuation.

coturn self-hosting

Mint short-lived REST credentials for real-time calls and audit a config snippet before deploying it.

Support triage

Decode a user-supplied ICE server list or pasted config into readable verdicts and spot bad transports, ports or IPv6 hosts.

Scheme conventions

SchemeMeaning and default
stun:Address discovery only; port 3478; no credentials and no transport parameter.
turn:Relay over UDP by default; port 3478; ?transport=udp or ?transport=tcp selects the ICE transport.
turns:TURN over TLS on TCP by default; port 5349; transport=udp is not valid.
IPv6 hostBracket it: turn:[2001:db8::1]:3478?transport=tcp.
Ephemeral username<unix-expiry>:<label> by default; the separator must match coturn's rest-api-separator.

The port is omitted only when the Omit default port option is on and the chosen port equals the scheme default.

Common mistakes

Mistake:Writing turn://host:3478

Fix:ICE URIs have no // separator. Use turn:host:3478; the Analyze tab flags the legacy form.

Mistake:Using transport=udp with turns:

Fix:turns: is TLS over TCP. Pick tcp (the default) and the conventional port 5349.

Mistake:Changing the timestamp format in ephemeral usernames

Fix:coturn expects the unix expiry in seconds followed by the configured separator and optional label. Match rest-api-separator exactly.

Mistake:Embedding static username/password pairs in client bundles

Fix:Use short-lived HMAC credentials; static credentials extracted from client code can be reused by anyone.

Mistake:Forgetting IPv6 brackets

Fix:Write turn:[2001:db8::1]:3478 — the builder brackets an unbracketed literal for you.

Frequently asked questions

What is the username timestamp format for TURN?

For coturn's REST (use-auth-secret) scheme the username is the unix expiry time in seconds, followed by the configured separator (':' by default) and an optional user label, for example 1700003600:alice. The separator must match coturn's rest-api-separator setting or verification will fail.

How does use-auth-secret HMAC work?

The server holds a static-auth-secret. The client builds the timestamped username and computes base64(HMAC-SHA1(secret, username)) as the credential. coturn recomputes the same HMAC and accepts the request while the embedded expiry is in the future. The calculation runs locally here and the secret is never uploaded or stored.

turn: vs turns: — which port should I use?

turn: relays plain TURN traffic, normally on UDP port 3478. turns: is TURN over TLS on TCP, conventionally port 5349. The builder applies those defaults when the port is left blank and warns if you combine turns: with transport=udp.

Do I need transport=tcp?

Only if you want ICE to try TCP as well as UDP. Adding a second URL with ?transport=tcp under the same credentials is the common production pattern; the Both UDP + TCP option emits both URLs for you. STUN ignores the transport parameter entirely.

Are credentials safe to put in the browser?

Short-lived HMAC credentials are designed for this: they expire with the TTL and reveal no long-lived secret. Static username/password pairs embedded in client code can be extracted and reused, so prefer ephemeral credentials and rotate the server secret if one leaks.

Why is SHA-1 used to sign credentials?

coturn's REST API specifies HMAC-SHA1 for compatibility, not as a general hash choice. The security property that matters here is the unguessable secret and the short expiry window.

Can I paste a coturn config and generate credentials from it?

Yes. The Analyze tab reads common coturn keys such as listening-port, realm, fingerprint, use-auth-secret, static-auth-secret, rest-api-separator and external-ip. When a secret is found, the Load secret into builder action copies it into the generator without showing it in a share link.

Does this tool test whether my TURN server is reachable?

No. It is entirely offline: it builds and validates connection strings and decodes pasted configs. It never opens an ICE connection or contacts a STUN/TURN server.

References & standards