From installation to mastery, this complete guide will take you from zero to proficient with Clash. Covers platform installation, subscription import, rule configuration, TUN mode, DNS anti-pollution, and more.
If this is your first time using Clash, you only need four steps to complete the basic setup. We use Clash Verge Rev as the example client throughout this guide, as it is the most recommended desktop client with a clean interface and straightforward configuration.
Once you complete these four steps, you are ready to use Clash. The remaining chapters cover advanced configuration for a better experience. Make sure the basics work before moving on.
Windows is the most popular platform for Clash users. Clash Verge Rev delivers a polished Windows experience and supports Windows 10 and above (Windows 11 recommended).
Go to the Clash Verge Rev GitHub Releases page. In the latest release Assets, find the file named Clash.Verge_x.x.x_x64-setup.exe and download it.
Double-click the downloaded .exe file. If Windows SmartScreen shows a security prompt, click "More info" then "Run anyway". Follow the setup wizard, keep the default installation path, and click Install.
Launch Clash Verge Rev. The application will automatically set up its service mode. You may be asked to grant administrator permissions on first launch. After the interface loads, follow the Quick Start steps above to import your subscription and enable the system proxy.
Click the settings icon in the top-right corner. Under General Settings, enable "Launch at login" so Clash starts automatically with your system. It is also recommended to enable "Minimize to tray on startup" to keep things tidy.
Clash Verge Rev installs a service mode by default, which allows features like TUN mode to work without running the app as administrator. If service mode installation fails, the interface will show a prompt. Click the "Install Service" button to fix it.
macOS users need to select the correct version based on their chip type. Apple Silicon (M1/M2/M3/M4) users should choose the ARM64 version; Intel Mac users should choose x64.
Click the Apple menu in the top-left corner, then "About This Mac". If it shows "Chip: Apple M1/M2/M3/M4", you have Apple Silicon. If it shows "Processor: Intel", you have an Intel Mac.
Go to the GitHub Releases page and download the version matching your chip:
Apple Silicon: filename contains aarch64.dmg or arm64.dmg
Intel: filename contains x64.dmg
After downloading, double-click the .dmg file and drag Clash Verge Rev into the Applications folder.
On first launch, macOS may block the app with a "Cannot be opened because the developer cannot be verified" message. To resolve this:
1. Open System Settings, then Privacy & Security
2. Scroll down to find the Clash Verge Rev block notice
3. Click "Open Anyway"
Alternatively, use the terminal to remove the quarantine attribute:
# Run in Terminal (replace with actual app name)
xattr -d com.apple.quarantine /Applications/Clash\ Verge.app
Android users are recommended to use FlClash or Clash Meta for Android. Both are built on the Mihomo core and offer full-featured mobile experiences.
To prevent the system from killing Clash in the background, set the app to "Not optimized" in Battery Optimization settings, and lock it in the recent apps tray. Steps vary by Android manufacturer.
iOS offers several Clash-compatible clients. Due to Apple's App Store restrictions, all clients are distributed through the store.
Search for and download the client from a non-China-region App Store. After installation, open the app, find the Import or Config section, paste your subscription URL, activate the profile, and tap Connect.
iOS client availability may change at any time. Some clients may require a non-Chinese Apple ID. Follow our blog for the latest updates on iOS clients.
Linux desktop users can choose Clash Verge Rev or FlClash. Server users typically run the Mihomo core directly.
Download and install the .deb package:
# Download the deb package (replace with latest version)
wget https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v2.x.x/clash-verge_2.x.x_amd64.deb
# Install
sudo dpkg -i clash-verge_2.x.x_amd64.deb
# Fix dependency issues if any
sudo apt-get install -f
Install the .rpm package:
sudo rpm -i clash-verge_2.x.x.x86_64.rpm
For distribution-agnostic installation:
# Download AppImage
wget https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v2.x.x/Clash-Verge_2.x.x_x86_64.AppImage
# Make executable
chmod +x Clash-Verge_2.x.x_x86_64.AppImage
# Run
./Clash-Verge_2.x.x_x86_64.AppImage
A subscription URL is a special link provided by your proxy service that contains the configuration for all available nodes. It is essentially a Base64-encoded configuration file holding server addresses, ports, encryption methods, passwords, and all connection parameters.
Key characteristics of subscription links:
A typical subscription URL looks like this (redacted):
https://api.provider.com/sub/xxxxxx?token=yyyyyyyy
Your subscription link contains your account credentials and authentication token. If leaked, anyone can use your traffic quota. Never share your subscription URL in public channels, screenshots, group chats, or forums.
If you have a local YAML configuration file (for example, one you wrote yourself), you can import it directly:
~/.config/clash/.If the import fails, refer to our detailed subscription import troubleshooting guide for solutions.
Subscriptions do not auto-update by default. You need to trigger updates manually or set an update interval.
Right-click the profile card and select "Update", or click the refresh icon on the card. The client will re-download the subscription content to get the latest node list.
Clash Verge Rev supports setting an auto-update interval. Go to Settings then Update Interval and set a reasonable frequency (e.g., 1440 minutes for once every 24 hours). The client will then pull the latest subscription in the background automatically.
Some providers distribute subscriptions in formats incompatible with Clash (raw Shadowsocks, Surge, etc.). In these cases, use a subscription conversion tool to transform the link into Clash-compatible format. Common tools include sub-web (open-source frontend) and self-hosted subconverter backends.
Clash's rule-based traffic routing is its core strength. Rules determine which traffic goes through a proxy, which goes direct, and which is blocked. Mastering the rule system is essential for advanced Clash usage.
Clash processes rules sequentially:
DOMAIN,google.com,Proxy)DOMAIN-SUFFIX,google.com,Proxy matches google.com, www.google.com, maps.google.com, etc.)DOMAIN-KEYWORD,google,Proxy)IP-CIDR,192.168.0.0/16,DIRECT)GEOIP,CN,DIRECT)Below is a practical rule set suitable for daily use. It blocks ads, routes domestic sites directly, proxies foreign sites, and sends everything else through the proxy.
rules:
# ===== Ad blocking =====
- DOMAIN-KEYWORD,admarvel,REJECT
- DOMAIN-KEYWORD,admaster,REJECT
- DOMAIN-KEYWORD,adsage,REJECT
- DOMAIN-SUFFIX,adservice.com,REJECT
# ===== Proxy sites =====
- DOMAIN-SUFFIX,google.com,Proxy
- DOMAIN-SUFFIX,youtube.com,Proxy
- DOMAIN-SUFFIX,twitter.com,Proxy
- DOMAIN-SUFFIX,github.com,Proxy
- DOMAIN-SUFFIX,telegram.org,Proxy
# ===== Domestic direct =====
- DOMAIN-SUFFIX,baidu.com,DIRECT
- DOMAIN-SUFFIX,taobao.com,DIRECT
- DOMAIN-SUFFIX,qq.com,DIRECT
- DOMAIN-SUFFIX,bilibili.com,DIRECT
# ===== LAN direct =====
- IP-CIDR,127.0.0.0/8,DIRECT
- IP-CIDR,172.16.0.0/12,DIRECT
- IP-CIDR,192.168.0.0/16,DIRECT
- IP-CIDR,10.0.0.0/8,DIRECT
# ===== China IP direct =====
- GEOIP,CN,DIRECT,no-resolve
# ===== Fallback: everything else via proxy =====
- MATCH,Proxy
Rules are matched from top to bottom. Once a match is found, processing stops. Place ad-blocking rules first (highest priority), then specific proxy/direct rules, then LAN and GeoIP rules, and finally the MATCH fallback at the end.
For a deeper dive, read our beginner's guide to Clash rule configuration.
Maintaining a large rule set manually is tedious. We recommend using community-maintained rule sets:
Loading community rule sets via Rule Provider is covered in Chapter 5.
TUN mode is one of Clash's most powerful features. It creates a virtual network interface to capture all system traffic (not just HTTP/SOCKS proxy traffic), achieving true "full transparent proxying." With TUN mode enabled, all applications — including games, command-line tools, and apps that don't support proxy settings — have their traffic routed through Clash.
Normal "System Proxy" mode only proxies applications that respect HTTP/SOCKS proxy settings (mainly browsers). TUN mode captures all traffic, including:
Enabling TUN mode in Clash Verge Rev is straightforward:
In your Clash config file, TUN mode settings look like this:
tun:
enable: true
stack: system # Options: system / gvisor / mixed
dns-hijack:
- any:53 # Hijack all DNS queries
auto-route: true # Auto-configure routing table
auto-detect-interface: true # Auto-detect outbound interface
system: Best performance, best compatibility — recommended first choice.
gvisor: Google's user-space network stack — better isolation but slightly lower performance.
mixed: Hybrid mode — uses system stack for TCP, gvisor for UDP, balancing performance and compatibility.
For a complete walkthrough of TUN mode setup including stack selection and DNS hijacking configuration, read our TUN mode global proxy guide.
DNS pollution is one of the primary censorship techniques. Attackers return false IP addresses during DNS resolution, preventing you from accessing target websites or redirecting you to wrong servers. Clash's DNS module effectively prevents DNS pollution, ensuring accurate domain resolution.
When you query a blocked domain using standard DNS (UDP port 53), the censorship system responds with a fake IP address faster than the legitimate DNS server. Your device receives this fake IP and tries to connect to the wrong server, naturally failing to reach the target. This is DNS pollution.
Clash prevents DNS pollution through these mechanisms:
dns:
enable: true
listen: 0.0.0.0:1053
ipv6: false
enhanced-mode: fake-ip # Fake-IP mode (recommended)
fake-ip-range: 198.18.0.1/16 # Fake-IP address pool
fake-ip-filter: # Domains that skip fake-IP
- '*.lan'
- '*.local'
- 'localhost.ptqy.gitv.tv'
default-nameserver: # DNS for resolving DoH domains themselves
- 223.5.5.5
- 119.29.29.29
nameserver: # Domestic DNS
- https://doh.pub/dns-query
- https://dns.alidns.com/dns-query
fallback: # Overseas DNS (anti-pollution)
- https://dns.cloudflare.com/dns-query
- https://dns.google/dns-query
- tls://8.8.4.4:853
fallback-filter: # Conditions for using fallback
geoip: true
geoip-code: CN
ipcidr:
- 240.0.0.0/4
Fake-IP is Clash's recommended DNS mode. When an app requests DNS resolution, Clash immediately returns a fake IP (from the fake-ip-range) without performing a real DNS query, while recording the domain-to-fake-IP mapping. When the app actually initiates a connection, Clash intercepts it, matches rules based on the domain, then resolves the real IP using the correct DNS. Benefits include:
For an in-depth explanation of DNS anti-pollution mechanisms and a complete configuration guide, read our DNS anti-pollution configuration guide.
Proxy Groups are a core concept in Clash configuration. They define the egress strategy for traffic. With properly configured proxy groups, you can achieve flexible traffic scheduling and node switching.
select (Manual Selection) — The most common type. Users can manually choose a node from the group. Ideal for a "Node Select" group.
proxy-groups:
- name: "Proxy"
type: select
proxies:
- "Hong Kong"
- "Japan"
- "United States"
- DIRECT
url-test (Auto Select) — Automatically tests latency for all nodes in the group and selects the one with the lowest latency. Perfect for automatic optimal node selection.
- name: "Auto Select"
type: url-test
proxies:
- "Hong Kong"
- "Japan"
- "United States"
url: 'http://www.gstatic.com/generate_204'
interval: 300 # Test every 300 seconds
tolerance: 50 # Only switch if latency differs by 50ms+
fallback (Failover) — Tests nodes in order and selects the first available one. If the primary node goes down, it automatically switches to the next.
- name: "Failover"
type: fallback
proxies:
- "Hong Kong"
- "Japan"
- "United States"
url: 'http://www.gstatic.com/generate_204'
interval: 300
load-balance (Load Balancing) — Distributes traffic across multiple nodes to increase total bandwidth. Supports per-connection or per-session distribution.
Rule Providers allow you to load rule sets from remote URLs instead of writing all rules in your local config file. This keeps your rules up-to-date without bloating your local configuration.
rule-providers:
reject: # Ad blocking rules
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt"
path: ./ruleset/reject.yaml
interval: 86400
proxy: # Proxy domain rules
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt"
path: ./ruleset/proxy.yaml
interval: 86400
direct: # Direct connection rules
type: http
behavior: domain
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt"
path: ./ruleset/direct.yaml
interval: 86400
cncidr: # China IP ranges
type: http
behavior: ipcidr
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt"
path: ./ruleset/cncidr.yaml
interval: 86400
rules:
- RULE-SET,reject,REJECT
- RULE-SET,proxy,Proxy
- RULE-SET,direct,DIRECT
- RULE-SET,cncidr,DIRECT
- GEOIP,CN,DIRECT,no-resolve
- MATCH,Proxy
The biggest advantage of Rule Providers: rules are maintained by the community and auto-update. Set it up once, and your rules stay current. The interval parameter controls update frequency (in seconds) — 86400 = once per day.
Clash provides a RESTful API (external controller) that lets you remotely manage and monitor Clash through a web dashboard. The most popular web dashboards are Yacd and MetaCubeXD.
external-controller: 127.0.0.1:9090
secret: "your-secret-here" # Optional: set an access password
After configuration, access the web dashboard:
http://yacd.haishan.me, enter API address http://127.0.0.1:9090http://d.haishan.me, enter the same API addressIn the web dashboard you can: view real-time connections and traffic, switch proxy nodes, view logs, manage rules, and inspect DNS query history. Clash Verge Rev has a built-in Dashboard, so you usually don't need to open a separate web dashboard.
This is the most common issue for new users. Possible causes and solutions:
127.0.0.1:7890 (Clash's default port). If settings are abnormal, clear them manually and re-enable Clash system proxy.If nothing happens or you get an error when clicking import, try these steps:
= and &.If traffic isn't going through the proxy after enabling TUN mode, possible causes include:
dns-hijack includes any:53 to ensure all DNS queries are captured by Clash.A DNS leak means your real DNS queries bypass Clash, exposing the domains you're actually visiting. How to check:
browserleaks.com/dns or dnsleaktest.com and run a full test. If the DNS server IPs shown are your proxy server's IPs, you have no leak.enhanced-mode is set to fake-ip in your config.ipv6: false in your config.If a selected node won't connect (latency test times out or shows errors), troubleshoot these:
If none of the above solves your issue, visit the GitHub Issues page for your specific client to search or ask questions. For eight detailed causes and step-by-step fixes, see our node connection troubleshooting guide. You can also follow our blog for the latest troubleshooting guides.