Node HandbookNODE HANDBOOK中文
Subscription formats

Shadowrocket subscription to Clash: format, base64 and three traps

A Shadowrocket subscription and a Clash profile are different formats: an encoded URI list versus a structured document. Identify which one you hold before converting.

Node Handbook editorial team · · 8 min read
The short version
  • A Shadowrocket subscription returns a base64-encoded list of node URIs, one ss://, vmess://, trojan:// or vless:// per line. It is not Clash YAML. Pasting it into a Clash client yields invalid yaml or an empty profile.
  • Conversion is two steps: decode the payload, then map each URI's fields into a proxies entry. The concept is trivial; the field details are not.
  • Three traps: base64 variants, the vmess net/type/tls trio, and the ss plugin parameter. Miss any one and the node imports but never connects.
  • Identify the format first. Converting in the wrong direction wastes a full round.

30-second check: which format is this?

# look at the first 80 characters the subscription returns
curl -sL "your-subscription-url" | head -c 80

# A. long run of mixed-case letters and digits, no colons  -> base64 node list
# B. starts with cHJveHlzOi or H4sI                        -> base64 too (proxies: / gzip)
# C. literal proxies: / proxy-groups:                      -> Clash YAML already
# D. literal vmess:// / ss:// lines                        -> plain URI list

Only A and D convert into Clash. C is already Clash, and pushing it into Shadowrocket needs the reverse mapping. B needs one more step: decode, then gunzip.

What a Shadowrocket subscription actually is

Shadowrocket accepts two inputs: a base64-encoded list of node URIs, or, from a few providers, a plaintext URI list. It parses one URI as one node, and each URI carries its own protocol, address, port, credentials and transport parameters.

Clash clients parse something else entirely: a structured document where proxies is an array of objects whose keys are name, type, server, port, cipher. There is no universal mapping between the two models; you move field by field, per protocol.

That is why "Shadowrocket subscription to Clash" is not a file-extension change. It is reversing URI encoding into structured fields, and URIs leave many parameters optional. Omit one when writing YAML and it silently becomes a different meaning.

What happens if you paste it in

  • the remote profile data is invalid yaml: the parser reads base64 as YAML and the first line is not a key.
  • Import succeeds, node list is empty: some clients skip unrecognised entries without a warning.
  • Import succeeds, nodes listed, every connection times out: defaults filled in the wrong field. Usually cipher or network.

The third case wastes the most time because it looks successful. Do not trust the node count alone; open one node and compare server, port and cipher against the original URI.

Step one: decode the payload

curl -sL "your-subscription-url" -o sub.txt

python3 -c "
import base64
s=open('sub.txt').read().strip().replace('-','+').replace('_','/')
s+='='*(-len(s)%4)
open('nodes.txt','w').write(base64.b64decode(s).decode('utf-8'))
"
head -3 nodes.txt

You should see one URI per line. If the output is still binary, check the first two bytes: 1f 8b means gzip, so decompress once more.

Trap one: three base64 variants

Standard, URL-safe, and missing padding. Normalise the character set first, then pad to a multiple of four. Do not try three decoders in sequence: URL-safe input decoded by a standard decoder produces plausible but shifted garbage.

Trap two: vmess net, type and tls

vmess:// carries base64-encoded JSON with short keys, and this is where conversions break:

  • net becomes network: tcp, ws, grpc, h2.
  • type is empty for net=ws and http for TCP with HTTP obfuscation. Many scripts drop it.
  • tls is the string "tls" or empty, never a boolean. tls: true is an invalid field.
  • path and host must land in ws-opts.path and ws-opts.headers.Host. Wrong nesting equals missing.
  • A stand-alone sni maps to servername, not host.

Trap three: the ss plugin parameter

ss:// appears in two shapes: legacy ss://base64(method:password)@host:port and modern ss://base64(method:password@host:port)#name. Split either one correctly, or a password containing : gets truncated.

Worse, plugin nodes: ?plugin=obfs-local%3Bobfs%3Dhttp%3B... must be URL-decoded and split into plugin and plugin-opts. Drop it and the node imports, the handshake completes, and traffic goes nowhere. That looks exactly like a dead node, so people blame the provider.

Do it in one pass

If you only need a working profile, paste the subscription or the decoded URI text into the subscription converter. It identifies the input format first, then emits the proxies array. Parsing happens in the browser, so URLs with tokens stay local.

Then check three things: node count matches URI count, any node's server and port match the source, and plugin nodes kept plugin-opts.

It still will not connect: format or node?

Format errors are loud: import fails, or the node count is obviously wrong. Node errors are quiet: import is clean, nodes are complete, everything times out.

Connect once in Shadowrocket with the original subscription. Works there but not in Clash means a field mapping problem. Fails in both means the node or the local network, and the conversion is not at fault.

The reverse direction

Clash YAML into Shadowrocket is harder. YAML may contain rules, proxy groups and Clash-only fields, while Shadowrocket only understands node URIs. You rebuild each proxy as a URI: ss://, vmess:// (still base64 JSON), trojan://, vless://. Rules and groups do not survive and must be rebuilt in the app.

If the goal is simply "use the same nodes on iOS", the provider's native Shadowrocket subscription is more reliable than a reverse conversion, which always loses structure.

FAQ

Can I paste a Shadowrocket subscription into Clash Verge Rev?

No. It is a base64 node list, not YAML. You get invalid yaml or an empty profile. Decode it and map to a proxies array first.

Why does decoding fail with Incorrect padding?

The subscription dropped trailing padding or uses the URL-safe alphabet. Replace - with + and _ with /, then pad to a multiple of four. The subscription is not corrupt.

All nodes import but every connection times out.

Test the same subscription in Shadowrocket. Works there means a mapping bug: check cipher, network, ws-opts and ss plugin-opts. Fails in both means the node or your local network.

Can ss, vmess and trojan be converted together?

Yes, proxies is an array and protocols can mix. Each entry still needs its own mapping; vmess net and ss plugin have nothing in common.

Does converting leak my subscription URL?

Depends on the tool. A browser-local converter never uploads it. A subscription URL with a token is a credential: whoever holds it can pull your nodes.

Evidence and limits

The format checks rely on observable properties of the response body: presence of proxies:, the base64 alphabet, and whether the decoded bytes start with a gzip header. Field mappings follow the published parameter definitions of each URI scheme and can be verified against any single real node.

Limits: providers sometimes use non-standard parameter names that need per-provider handling. Shadowrocket's parser is not documented, so this page describes the two input shapes it accepts without inferring internals. Usability is decided by an actual connection attempt.

This page is also available in Chinese: 阅读中文版.