Xray or sing-box: what is the difference between the two cores

Xray and sing-box are cores: the programs inside a client that actually speak VLESS, Trojan, Shadowsocks and the rest. Xray comes from the XTLS team and is the home of Reality, Vision and xhttp. sing-box, by SagerNet, is a universal core with more protocols and its own TUN. Most links open in both; the differences lie in a few protocols and transports and in the config format.

Updated

On this page

What a core is

A VPN client is usually two layers. The app is the window: the server list, the buttons and the settings. The core is the program underneath that opens the connection to the server, speaks the protocol and decides where each packet goes. Many popular clients are built on one of these two cores, and some carry both and pick one per server.

That is why two different apps can open the same vless:// link: the link is a common format, and the core inside each one reads it. It is also why an app sometimes says it needs to download a module, a component or a core: the window is there, but the program that speaks the protocol isn't yet. Both cores are free and open source, both are written in Go, and both run on Windows, macOS, Linux and Android.

Xray: the XTLS team's core

Xray (Xray-core) appeared in 2020 as a fork of V2Ray, made by the XTLS team, the authors of VLESS. It kept V2Ray's structure and config format and grew its own features on top. Most new ideas around VLESS appeared in Xray first.

  • Reality — the disguise that borrows a real website's TLS handshake. It was created in Xray.
  • XTLS Vision — the xtls-rprx-vision flow that hides the TLS-inside-TLS pattern.
  • xhttp — an HTTP transport that can split upload and download into separate requests and goes through CDNs. sing-box doesn't have it.
  • mKCP — a transport over UDP, also missing from sing-box.
  • VLESS encryption — an optional encryption layer of VLESS itself, added in newer versions. Such links carry a long value in encryption instead of none.
  • Server panels — 3x-ui, Marzban and Remnawave run Xray servers, and many subscriptions come straight out of them, sometimes as Xray JSON instead of links.

sing-box: the universal core

sing-box is made by SagerNet and was written from scratch as a universal platform: one program, one config format and many protocols, on the client side and the server side. It supports VLESS with Reality and Vision too, so for a typical VLESS Reality link it makes no difference which of the two cores opens it.

  • Protocols — VLESS, VMess, Trojan, Shadowsocks, Hysteria2, TUIC, WireGuard, ShadowTLS, AnyTLS, plus SOCKS, HTTP and others.
  • Hysteria2 and TUIC — the QUIC protocols for lossy networks are first-class here. Recent Xray versions added Hysteria2, but TUIC, ShadowTLS and AnyTLS are found in sing-box, not in Xray.
  • TUN — sing-box has had its own TUN inbound from early on: a virtual network adapter that takes the traffic of the whole system and sets up the routes by itself. That is a big reason apps use it for a system-wide VPN.
  • Rules — routing by domain, IP address, process and app, with rule sets in its own .srs format, plus groups that test servers and take the fastest (urltest) or let you pick one (selector).

What each core has

  • VLESS, VMess, Trojan, Shadowsocks

    XrayYes

    sing-boxYes

  • Reality and the Vision flow

    XrayYes, both were created here

    sing-boxYes

  • WebSocket, gRPC, HTTPUpgrade

    XrayYes

    sing-boxYes

  • xhttp and mKCP transports

    XrayYes

    sing-boxNo

  • VLESS encryption (ML-KEM)

    XrayYes, in newer versions

    sing-boxNo

  • Hysteria2

    XrayIn recent versions

    sing-boxYes

  • TUIC, ShadowTLS, AnyTLS

    XrayNo

    sing-boxYes

  • Config format

    XrayJSON with inbounds, outbounds, streamSettings, routing

    sing-boxJSON with inbounds, outbounds, tls, transport, route

The same server in each config

Both cores are set up with JSON, but the files are not interchangeable: an Xray config won't start in sing-box, nor the other way round. Here is one VLESS Reality server in each. First Xray: the protocol is named in protocol, the server and user sit in settings, and the transport and security in streamSettings.

config.json
{
  "outbounds": [
    {
      "tag": "proxy",
      "protocol": "vless",
      "settings": {
        "vnext": [
          {
            "address": "203.0.113.10",
            "port": 443,
            "users": [
              {
                "id": "b084aee0-3421-4499-a473-f4ecbba7b3b8",
                "encryption": "none",
                "flow": "xtls-rprx-vision"
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "tcp",
        "security": "reality",
        "realitySettings": {
          "serverName": "www.example.com",
          "fingerprint": "chrome",
          "publicKey": "eGjsq-1bTItSi448hnpbXv6_8OamCZWoemCtrZMB3KU",
          "shortId": "07759ef874c6d4f8"
        }
      }
    }
  ]
}

The same server for sing-box: the protocol is type, the address and UUID sit at the top of the outbound, security goes into a tls block with reality inside, and a transport, when there is one, into a transport block.

config.json
{
  "outbounds": [
    {
      "type": "vless",
      "tag": "proxy",
      "server": "203.0.113.10",
      "server_port": 443,
      "uuid": "b084aee0-3421-4499-a473-f4ecbba7b3b8",
      "flow": "xtls-rprx-vision",
      "tls": {
        "enabled": true,
        "server_name": "www.example.com",
        "utls": {"enabled": true, "fingerprint": "chrome"},
        "reality": {
          "enabled": true,
          "public_key": "eGjsq-1bTItSi448hnpbXv6_8OamCZWoemCtrZMB3KU",
          "short_id": "07759ef874c6d4f8"
        }
      }
    }
  ]
}

Routing differs too. Xray keeps its rules under routing and matches sites with the geosite.dat and geoip.dat files; sing-box keeps them under route and uses rule sets in .srs files. Share links such as vless:// are the common ground: apps on either core read them, which is why services hand out links and subscriptions rather than raw configs.

Which one you need

  • An ordinary VLESS Reality, VMess, Trojan or Shadowsocks link — either core opens it, so the app decides.
  • A link with type=xhttp or type=kcp, or VLESS with encryption turned on — Xray only.
  • Hysteria2, TUIC, ShadowTLS or AnyTLS — sing-box. For Hysteria2 a recent Xray also works.
  • A ready config file — the core it was written for. An Xray JSON has protocol and streamSettings, a sing-box JSON has type and tls.
  • A subscription in the wrong format — convert it. The free subscription converter on this site, /tools/subscription/, turns links, base64 subscriptions, Clash / mihomo YAML and sing-box JSON into one another right in the browser. It doesn't read Xray JSON yet, and xhttp servers can't be written for sing-box, so it lists them as skipped.

In Veli

Veli carries both and picks per link

On a computer Veli runs most links on sing-box: it holds the virtual adapter and the rules by app and by site. Xray comes in only for the links sing-box can't open, xhttp, mKCP and VLESS encryption, and then sing-box hands that server's traffic to Xray, so the rules keep working. You don't choose the core: paste the link into Profiles → Add, and if the module isn't there yet, the app offers to install it. It downloads the official sing-box or Xray build from GitHub, or from the Veli site when GitHub doesn't open, and checks the file's SHA-256 before running it. What is installed, and which version, is shown in Settings → Advanced.

Ready configs go into the same field: sing-box JSON and Xray JSON, including the Xray JSON subscriptions that panels hand out. On Android, Xray is built into the app, so nothing is downloaded. VLESS, VMess, Trojan, Shadowsocks and Hysteria2 connect there, while TUIC and ready-made sing-box and Clash configurations don't, and the app says so right away.

FAQ

Is sing-box better than Xray?

Neither is better for every case. Ordinary VLESS Reality links open in both; Xray is needed for xhttp and mKCP, and sing-box for TUIC, ShadowTLS and AnyTLS.

Does sing-box support xhttp?

No. xhttp is an Xray transport, so a link with type=xhttp needs Xray or an app that carries Xray inside.

Can I use an Xray config in sing-box?

Not as it is: the formats differ. Share links and subscriptions are common to both; a config file has to be rewritten for the other core, or opened in an app that reads both formats.

Is Xray the same as V2Ray?

Xray started in 2020 as a fork of V2Ray and kept its config format, but it has gone its own way since: Reality, Vision and xhttp come from Xray.

sing-box and Xray in one app

Paste any link into Veli: the app picks the core, installs it if needed and checks the file first.