Start with one complete example before moving into individual fields and deeper adjustments.
Clash config guide and structure example
Review a Clash config example, understand how the structure is organized, and see how proxies, groups, rules, and DNS work together in one readable setup.
Who this guide helps most
This guide is especially useful if you want to understand how a config file works before editing, importing, or troubleshooting it.
Useful if you want to know why sections are arranged the way they are instead of only copying a file.
Helpful if you want to understand the overall structure first, then adapt it to your own setup and routing needs.
Complete config example
Seeing the full file first often makes the structure easier to understand than jumping directly into individual fields.
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: "๐ Node Select"
type: select
proxies:
- "HK-01"
- "JP-01"
- DIRECT
- name: "๐ Global Traffic"
type: select
proxies:
- "๐ Node Select"
- "HK-01"
- "JP-01"
rules:
- DOMAIN-SUFFIX,google.com,๐ Global Traffic
- DOMAIN-SUFFIX,youtube.com,๐ Global Traffic
- GEOIP,CN,DIRECT
- MATCH,๐ Node Select
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
The sections below explain what a typical Clash config contains and what each part controls inside the file.
Base settings
These usually include ports, mode, log level, and IPv6 behavior. This layer controls the core runtime behavior of the client.
Proxies
This section defines the actual node information such as name, type, server address, port, and authentication details.
Proxy groups
This section decides how nodes are organized and used, such as manual choice, automatic choice, or grouping by purpose.
Rules
Rules decide which traffic should follow which route. This is one of the main logic layers in the whole config file.
DNS
DNS controls resolution strategy and fallback logic. Many connection issues are tied directly to how this part is configured.
Other common fields
Things like TUN mode, external control, or subscription expansion belong more to advanced use and are not always the first priority for beginners.
Common config mistakes
When a file fails, the cause is often not the node itself, but the structure, formatting, or reference logic inside the config.
YAML indentation errors
Clash configs rely on YAML structure. Broken indentation can cause import failures or make fields unreadable.
Broken proxy group references
If a proxy group points to a node name that does not exist, or names do not match exactly, the overall logic can break.
Unclear rule order
Rules are matched in order. If a broad rule appears too early, the more specific rules below it may never run.
DNS settings that do not fit the scene
Even if the syntax is correct, mismatched DNS behavior can still create unstable or confusing results in actual use.
Config questions
These questions focus on how to read the example, how to treat the structure, and what usually causes errors in real imports.
Can I copy this Clash config example and use it directly?
Usually not as-is. It is better used as a structure reference, then adapted with your own nodes, groups, rules, and DNS choices.
Why does my Clash config show an import error?
Common reasons include YAML indentation issues, spelling mistakes, missing node references, or fields placed in the wrong structural position.
How is this different from a subscription config?
This guide is better for understanding file structure, while a subscription config is more about fetching and updating ready-made content automatically.
Do I need to read this before I start using Clash?
Not always. If you only want to begin quickly, download and FAQ are better first stops. This guide matters more when you want to understand structure and setup logic.
Move from structure into actual setup
Once the file structure makes sense, the next step is usually download, setup, or feature review, depending on what you still need to clarify.