User Guide / Rules & Routing

Clash rule syntax 101: reading your first rule

Rules & Routing · Updated 2025-11-15 · ~2 min read

Open any profile and the rules: section is a long list like this:

rules:
  - DOMAIN-SUFFIX,google.com,Proxy Select
  - DOMAIN-KEYWORD,bilibili,DIRECT
  - IP-CIDR,192.168.0.0/16,DIRECT
  - GEOIP,CN,DIRECT
  - MATCH,Proxy Select

Every line is a three-part statement — TYPE,matcher,policy:

For each connection Clash walks the list top to bottom and stops at the first match — which is why ordering is everything (see "Rule priority").

With this mental model you can read the Rule column on the Connections page — and you have the foundation for writing rules of your own.