TLS fragmentation (fragment): what it is and when it helps

TLS fragmentation splits the first message of a secure connection, the ClientHello, into several small pieces. Simple filters read the site name (SNI) from the first packet; if the name isn't there whole, they can miss it, while the server joins the pieces and sees an ordinary handshake. It helps against filtering by name, not against a blocked IP address, and it doesn't apply to QUIC protocols.

Updated

On this page

What the ClientHello is and why filters read it

Every TLS connection, an HTTPS page or a VLESS, VMess or Trojan profile with TLS, starts with a ClientHello: the client's first message, saying which versions and ciphers it supports and which site it wants. The site's name sits in a field called SNI, server name indication, and travels unencrypted, because the server needs it to pick the right certificate.

That makes the ClientHello the easiest place to filter by name. A filter doesn't have to decrypt anything: it looks at the first packets of a new connection, finds the SNI and compares it with a list. If the name is on the list, the connection is reset or stops getting answers.

A newer extension, ECH (Encrypted Client Hello), encrypts the name itself, but the server has to support it and not every network lets it through. Fragmentation is the older, simpler trick: it doesn't hide the name, it only splits it.

How fragmentation works

Normally the ClientHello leaves in one piece. With fragmentation the client cuts it into several small pieces, into separate TCP packets or separate TLS records, and sends them one after another, sometimes with a short pause in between.

For the server nothing changes: TCP puts the packets back in order, TLS joins the records, and the server gets the same handshake. A filter that looks only at the first packet, or doesn't put the stream together, sees a piece without the full name and lets the connection pass. The name is still there in plain text, only split, so a filter that reassembles the stream reads it anyway.

In Xray-based clients the setting usually has three values: which packets to split (tlshello, the ClientHello), the size of the pieces in bytes and the pause between them in milliseconds, each a range such as 10-20; in an Xray config they are packets, length and interval. In sing-box it is a switch in the tls block, fragment, with record_fragment for splitting into TLS records.

When it helps

  • Filtering by name — the server's address answers, but the TLS handshake with your domain breaks off at once: a reset, an EOF, a timeout right after connecting. This is exactly the case fragmentation is for.
  • TLS profiles with a domain — VLESS, VMess or Trojan with security=tls, over tcp, ws, grpc, httpupgrade or xhttp. That includes profiles behind a CDN: there the IP address belongs to the CDN, and the domain name in the handshake is often the only thing a filter can catch.
  • Simple filters — ones that look at single packets. Against DPI that reassembles the stream it helps less or not at all, and what works with one provider may not work with another.

When it doesn't help

  • The server's IP address is blocked — the connection doesn't get as far as a handshake, so there is nothing to split. You need another server or another address.
  • QUIC and UDP protocols — Hysteria2, TUIC, WireGuard and AmneziaWG have no TLS handshake over TCP. Their packets travel over UDP, and if UDP is blocked or throttled, fragmentation changes nothing.
  • Proxies without TLS — Shadowsocks or VLESS with security=none send no ClientHello at all.
  • Allowlist networks — where only approved sites get through, a handshake without a readable name is blocked just the same.
  • Filtering by traffic pattern — fragmentation changes only the first message. Long heavy sessions to one address and other signs stay as they were.

Why it breaks Reality, Hysteria2 and TUIC

Reality's disguise is a handshake that looks exactly like a browser opening a real website, and the server checks that ClientHello closely before it lets the client in. Cut it into pieces and the server may not accept it, and it no longer looks like a browser either. Reality doesn't need fragmentation anyway: the name it shows belongs to a real website the network lets through.

Hysteria2 and TUIC run on QUIC over UDP. There is no TCP stream to cut, and forcing fragmentation on them breaks their handshake. Hence the common rule: fragmentation is not for Reality, Hysteria2 or TUIC.

What it costs

Each new TLS connection starts a little later, because the pieces go one by one and clients often pause between them. You notice it as a slightly slower first connection; once the connection is up, the speed is the same. Turn it on when the handshake is being blocked, not just in case.

How to tell whether it can help

Take the server address and the domain from your config (the sni value, or the address after the @) and check two things: whether the address answers at all, and whether a TLS handshake with that name gets through.

Windows (PowerShell)
Test-NetConnection 203.0.113.10 -Port 443

Put your server's address in. TcpTestSucceeded : True means the address and port answer; False means they are closed, and fragmentation won't help.

macOS / Linux
nc -vz 203.0.113.10 443

“succeeded” (or “Connected”) means the address answers; a timeout or a refusal means it is closed.

Windows (PowerShell)
curl.exe -sv -o NUL https://example.com

Put your domain in place of example.com. If the address answered but the output stops right after connecting, with a reset, an SSL error or a timeout, the handshake with that name is being blocked.

macOS / Linux
curl -sv -o /dev/null https://example.com

The same check: a line saying the TLS or SSL connection is set up means the handshake passed.

  • The address doesn't answer at all

    CauseThe server's IP address or port is blocked, or the server is down

    What to doFragmentation won't help: take another server

  • The address answers, the handshake breaks off at once

    CauseFiltering by the name in the ClientHello

    What to doTurn fragmentation on and reconnect

  • It worked with fragmentation, then stopped again

    CauseThe filter now reassembles the stream, or the address got blocked

    What to doTry a Reality profile or another server

  • A Reality profile stopped connecting after fragmentation was turned on

    CauseReality can't take a split handshake

    What to doTurn fragmentation off for Reality profiles

  • Hysteria2 or TUIC doesn't connect, and fragmentation changes nothing

    CauseUDP is blocked or throttled on this network

    What to doTake a TCP profile, such as VLESS Reality

  • The first connection takes a little longer

    CauseThe pieces of the handshake go one by one

    What to doThat is normal; turn it off if the network doesn't need it

In Veli

Settings → Security: Fragment the TLS handshake

In Veli on a computer, fragmentation is one switch: Settings → Security, “Fragment the TLS handshake”. The hint under it reads: “The start of the TLS connection goes out in small pieces — harder for DPI to spot the server. Not for Reality, Hysteria2 or TUIC”. It is off by default and takes effect on the next connection, so if the VPN is already on, reconnect.

The switch works on every profile where TLS runs over TCP: VLESS, VMess and Trojan with ordinary TLS, whether sing-box or Xray runs them. Reality, Hysteria2 and TUIC profiles are left as they are even with the switch on, so you don't need to turn it off for them. If an Xray JSON config came with a fragment outbound of its own, Veli takes only the server from it, and fragmentation is up to this switch. The Android app has no such switch.

FAQ

What does fragment mean in a VPN config?

It is TLS handshake fragmentation: the client sends the ClientHello in small pieces so that filters reading the site name in the first packet miss it. The server joins the pieces and sees a normal handshake.

Does fragmentation help if the server's IP is blocked?

No. It changes only the handshake; if the address itself doesn't answer, there is nothing to split, and you need another server.

Should I turn on fragmentation for Reality?

No: it breaks Reality's handshake, and Reality doesn't need it. In Veli the switch leaves Reality profiles alone anyway.

Does TLS fragmentation slow down the VPN?

Only the start of each new connection, and only a little, because the pieces go one after another. Once the connection is up, the speed doesn't change.

Fragmentation in Veli is one switch

Settings → Security → “Fragment the TLS handshake”. Reality, Hysteria2 and TUIC are left alone by themselves.