Clash Config Guide and Structure Example
A structured walkthrough of a Clash configuration file β sample, structure, common mistakes and related questions β so you can understand how modules fit together.
Who this section is for
First-time readers
Start from a full, readable example before diving into fields.
Structure learners
Understand why modules are organized the way they are.
Template seekers
Use a readable sample as a base you can adapt.
Full example
Look at the whole shape first, then break it down module by module.
port: 7890
socks-port: 7891
mixed-port: 7893
allow-lan: false
mode: rule
log-level: info
ipv6: false
proxies:
- name: "HK-01"
type: ss
server: example-hk.server.com
port: 443
cipher: aes-256-gcm
password: your-password
- name: "JP-01"
type: ss
server: example-jp.server.com
port: 443
cipher: aes-256-gcm
password: your-password
proxy-groups:
- name: "Nodes"
type: select
proxies:
- "HK-01"
- "JP-01"
- DIRECT
- name: "Overseas"
type: select
proxies:
- "Nodes"
- "HK-01"
- "JP-01"
rules:
- DOMAIN-SUFFIX,google.com,Overseas
- DOMAIN-SUFFIX,youtube.com,Overseas
- GEOIP,CN,DIRECT
- MATCH,Nodes
dns:
enable: true
listen: 0.0.0.0:1053
ipv6: false
enhanced-mode: fake-ip
nameserver:
- 223.5.5.5
- 119.29.29.29
fallback:
- 8.8.8.8
- 1.1.1.1
Structure breakdown
Basics
Ports, mode, log level and IPv6 β the runtime foundation.
proxies
Node definitions: name, type, server, port and credentials.
proxy-groups
How nodes are organized and selected: manual, auto or by purpose.
rules
Which path each traffic type takes β a critical logic layer.
DNS
Resolution strategy and fallback β many connection issues trace back here.
Other fields
TUN, external control, subscription extensions and other advanced items.
Common mistakes
YAML indentation errors
Config depends on YAML; wrong indentation breaks parsing.
Bad proxy-group references
Referencing missing or mismatched node names breaks logic.
Rule order issues
Rules match in order; broad rules first can shadow later ones.
DNS misunderstanding
DNS looks secondary but often causes connection anomalies.
FAQ
Can I copy this example directly?
Not recommended. Use it as structural reference and replace with your own nodes, groups and rules.
Why do I get errors after import?
Common causes: YAML indentation, misspelled fields, missing node references or misplaced fields.
How is this different from subscription config?
This is for understanding structure; subscription config focuses on auto-fetching ready content.
Do I need this to start quickly?
Not necessarily. If you just want to start, Download and FAQ are usually more useful first.