Clash Tutorials
A comprehensive guide from installation to advanced configuration. Whether you are a beginner or a power user needing custom rule routing, this page provides step-by-step instructions and configuration examples.
3 Steps to Get Started [QUICKSTART]
Clash is a rule-based network proxy client driven by YAML configuration files. Follow these three steps to finish basic setup in 5 minutes and start using the proxy.
Go to the download page and choose the appropriate Clash client for your OS. Windows recommends Clash for Windows or Clash Verge Rev, macOS recommends ClashX Meta, and Android recommends Clash Meta.
In the Profiles/Config panel, paste the YAML subscription link from your service provider and click Download. The client will automatically parse nodes, rulesets, and policy groups.
Turn on the 'System Proxy' switch to enjoy low-latency routing. To intercept all traffic (including games and CLI), refer to the TUN Mode configuration chapter.
https://... link. Clash itself is a free open-source client and does not provide any proxy nodes or services.
Installation Guide [PLATFORM]
Select your OS to view the full installation and initial setup steps.
Windows Clash Client Tutorial
For Windows, we recommend the classic Clash for Windows or the modern Clash Verge Rev. Both support Windows 10/11 and are compatible with all YAML subscription formats.
-
Download and InstallGo to the Download Page and get the
.exeinstaller for Clash for Windows or Clash Verge Rev. Run the installer; if SmartScreen blocks it, click "More info" → "Run anyway". -
Import SubscriptionClash for Windows: Click Profiles, paste your URL at the top, and click Download. Click the profile name to activate it.
Clash Verge Rev: Go to Subscription, paste the link, save, and then click the profile entry to activate. -
Enable ProxyClash for Windows: Enable System Proxy on the General page.
Clash Verge Rev: Toggle System Proxy in Settings. The tray icon will change color when active. -
(Advanced) Enable TUN ModeTo proxy games or CLI traffic, enable TUN Mode. Clash for Windows requires installing "Service Mode" first via General → Service Mode → Install. Clash Verge Rev can enable TUN directly in settings after granting admin permission.
macOS Clash Client Tutorial
For macOS, we recommend Clash Verge Rev or ClashX Meta. Both support the Mihomo core and are optimized for both Apple Silicon (M1/M2/M3) and Intel Macs.
-
Download and InstallGo to the Download Page. Choose Clash Verge Rev (.dmg) or ClashX Meta (.zip) based on your chip type. Drag the app into your Applications folder.
-
Import SubscriptionClash Verge Rev: In the "Subscription" tab, click the "+" icon, paste your URL, and save.
ClashX Meta: Click the menu bar icon → Config → Remote config → Manage, then click Add to paste your link. -
Enable System ProxyClick the menu bar icon and select Set as System Proxy. The icon will change color to indicate it is active.
-
(Advanced) Enable Enhanced ModeClick the menu bar icon → Enhanced Mode. This is equivalent to TUN mode and allows global traffic interception.
Clash Meta for Android Guide
For Android, we recommend Clash Meta for Android. It is based on the open-source Mihomo core and offers more features and better protocol support than the original version.
-
Download and Install APKGo to the Download Page. We recommend the Universal APK. Once downloaded, run the APK to install (you may need to allow "Install unknown apps" in system settings).
-
Import SubscriptionOpen Clash Meta for Android, tap Profiles → + icon → select "File from URL". Paste your link and tap the save icon. Then, tap the profile to activate it.
-
Start ProxyReturn to the home screen and tap the grey Stopped button. Accept the system VPN request; the button will change to Running.
-
(Advanced) Enable TUN ModeIn Settings → Network, enable Auto Route. This activates TUN mode, allowing the app to intercept traffic from all applications seamlessly.
Clash-compatible Clients for iOS / iPadOS
Stash Tutorial
-
Purchase and Download StashUsing a US/HK Apple ID, search for Stash in the App Store and purchase it (approx. $4.99).
-
Add Subscription ConfigurationOpen Stash → Config tab → + in the top-right → select "Download from URL". Paste your subscription link, name it, and tap "Done".
-
Start ProxySwitch to the Home tab and tap "Connect". Accept the iOS VPN request to start the proxy.
-
Select NodesIn the Proxy tab, you can view policy groups and select nodes manually, or tap the lightning icon for a latency test to auto-select the best node.
Shadowrocket Tutorial
-
Purchase and Download ShadowrocketUsing a US Apple ID, search for Shadowrocket in the App Store and purchase it ($2.99).
-
Import Subscription LinkOpen Shadowrocket → tap + in the top-right → set Type to "Subscribe" → paste subscription URL → tap "Done". Nodes will be parsed and displayed in the list.
-
Start ConnectionSelect a node from the list and toggle the Connected switch at the top. Tap "Allow" to authorize the VPN and start proxying.
Surge 5 Tutorial
-
Download Surge 5Search for Surge 5 in the App Store. The app offers a 14-day free trial, after which a license is required.
-
Import ConfigurationOn the home screen, tap the current profile → "Download from URL", paste your subscription link, and download.
-
Start ProxyTap "Start" in the top-right and authorize the VPN. Surge 5 automatically recognizes most Clash subscription formats.
Linux Clash Client Tutorial (GUI)
For Linux desktop users, we recommend Clash Verge Rev. It provides a modern graphical interface and full TUN mode support, compatible with Ubuntu, Debian, Fedora, and more.
-
Download and InstallGo to the Download Page and get the package for your distribution (
.debfor Ubuntu/Debian,.rpmfor Fedora/CentOS). Install it using your package manager. -
Import SubscriptionLaunch Clash Verge, go to the Subscription tab, click "+", paste your URL, and save.
-
Enable ProxyEnable "System Proxy" on the home screen. For global interception, activate TUN Mode in settings (may require
sudopermissions).
Clash Core for Linux (Advanced/Server)
Suitable for headless server environments or advanced users preferring manual deployment.
-
Download and Extract CoreDownload the .gz archive for your architecture, extract it, and grant executable permissions:$wget https://clashconf.com/assets/clients/core/mihomo-linux-amd64.gz$gunzip mihomo-linux-amd64.gz$chmod +x mihomo-linux-amd64$sudo mv mihomo-linux-amd64 /usr/local/bin/clash
-
Place Configuration FilePlace your config.yaml into the Clash configuration directory:$mkdir -p ~/.config/clash$cp config.yaml ~/.config/clash/config.yaml
-
Start ClashStart Clash; it will listen on
127.0.0.1:9090for the RESTful API by default:$clash -d ~/.config/clash -
Configure ProxyConfigure your environment variables to use the Clash ports (default 7890/7891):$export http_proxy=http://127.0.0.1:7890$export https_proxy=http://127.0.0.1:7890
Import Subscription [SUBSCRIPTION]
A Subscription URL is an online address (usually starting with https://) provided by your service provider that points to a YAML configuration file. Clash clients use this link to automatically download nodes, rulesets, and policy groups.
What is a Subscription Link?
A subscription link is essentially a URL pointing to a YAML config file. Every time you update the subscription in your client, Clash requests this URL to fetch the latest node info and rules.
Recommended Update Frequency
24h (once per day) to keep node info current. If nodes fail or time out, you can manually click "Update" to force a refresh.
Import Comparison Table
| Platform / Client | Import Path | Activation Method |
|---|---|---|
| Clash for Windows | Profiles → Top URL input → Enter | Click Profile Name |
| ClashX Pro (macOS) | Menu Bar → Config → Remote config → Manage | Click Select |
| Clash for Android | Profiles → + → Import from URL | Tap the circle next to Profile |
| Stash (iOS) | Profiles → + → Import from URL | Auto-activates after completion |
| Clash Core (Linux) | wget <URL> -O ~/.config/clash/config.yaml |
Restart Clash process |
YAML Config Deep Dive [CONFIG.YAML]
All Clash behaviors are driven by config.yaml. Understanding core fields helps you fine-tune proxy behavior, add custom nodes, and write advanced routing rules.
Basic Ports and Run Modes
Proxy Nodes (proxies)
The proxies field defines all available outbound nodes, supporting protocols like Shadowsocks, VMess, Trojan, VLESS, Hysteria2, WireGuard, and more:
Supported Protocol Types
Policy Groups (proxy-groups)
Policy groups organize multiple nodes according to specific selection strategies. Supported modes: select (manual), url-test (auto latency), fallback (failover), and load-balance (load balancing):
TUN Mode Configuration [TUN MODE]
TUN mode creates a virtual network interface (TUN/TAP) in the OS to intercept all TCP/UDP traffic at the kernel level. This includes apps that don't follow system proxy settings (e.g., games, CLI tools, UWP apps), achieving true transparent proxying.
When to Enable TUN Mode
| Scenario | TUN Needed? | Description |
|---|---|---|
| Game Acceleration (International Servers - UDP) | ✅ Required | Games use UDP protocol, which bypasses the system HTTP proxy |
| Terminal / curl / git Proxy | ⚠️ Optional | Can be replaced by the http_proxy environment variable |
| Windows UWP App Proxy | ✅ Required | UWP apps use sandboxing that isolates them from the system proxy |
| Standard Web Browsing | ❌ Not Required | Browsers automatically follow system HTTP proxy settings |
| Router / NAS Global Transparent Proxy | ✅ Required | Needed to intercept traffic from all connected devices |
Enable TUN in YAML Configuration
Advanced Rules [RULES]
Clash's rule engine is its core strength. By listing rules from highest to lowest priority in the rules field, you can precisely decide whether each request goes through PROXY, DIRECT, or is REJECTed.
Rule Type Quick Reference
| Rule Type | Example | Description |
|---|---|---|
| DOMAIN | DOMAIN,google.com,PROXY |
Exact match of the full domain |
| DOMAIN-SUFFIX | DOMAIN-SUFFIX,youtube.com,PROXY |
Match domain and all subdomains |
| DOMAIN-KEYWORD | DOMAIN-KEYWORD,openai,PROXY |
Domain contains the specified keyword |
| IP-CIDR | IP-CIDR,192.168.0.0/16,DIRECT |
Match by IP address range (CIDR) |
| GEOIP | GEOIP,CN,DIRECT |
Match by GeoIP location (CN for Mainland China IP) |
| PROCESS-NAME | PROCESS-NAME,steam.exe,PROXY |
Match by process name (Desktop only) |
| RULE-SET | RULE-SET,gfw,PROXY |
Reference external rule sets (rule-providers) |
| MATCH | MATCH,DIRECT |
Fallback rule for all unmatched requests (must be last) |
Recommended Rule Structure Example
rule-providers field to automatically fetch and schedule updates, avoiding the need to manually maintain thousands of rules.
Policy Groups [PROXY-GROUPS]
Policy groups (proxy-groups) determine which outbound node is actually used after a rule is matched. A well-designed policy group structure enables advanced features like automatic selection, failover, and load balancing.
Policy Group Type Explanation
| Type | Description | Recommended Scenario |
|---|---|---|
| select | Manually select a node or subgroup from the list | Main outbound group for manual switching |
| url-test | Periodically pings a URL and auto-selects the node with the lowest latency | Automatic optimization (Recommended for daily use) |
| fallback | Sequentially checks node availability and auto-skips failed nodes | Ensuring node stability |
| load-balance | Distributes connections across multiple nodes for load balancing | High-concurrency multi-node download scenarios |
DNS Leak Protection Setup [DNS]
DNS leakage occurs when DNS queries bypass the proxy and are sent directly to your ISP's DNS servers, exposing your browsing history. Clash resolves this via its built-in DNS module and fake-ip mode.
Recommended DNS Module Configuration
fake-ip mode, Clash immediately returns a fake IP (from the 198.18.0.0/16 range) for all DNS requests. The actual DNS resolution happens at the remote proxy node when traffic arrives, completely preventing local DNS leaks and significantly reducing connection latency.
FAQ [FAQ]
1. Add
GEOIP,CN,DIRECT to your rules to ensure local IPs connect directly;2. Use
rule-providers with a community-maintained direct (local domain whitelist) ruleset;3. Ensure your DNS config routes local domains to local DNS servers (e.g., AliDNS
223.5.5.5).macOS / Linux:
~/.config/clash/config.yamlWindows:
%USERPROFILE%\.config\clash\config.yamlIn Clash for Windows, you can click "Open Clash Home Folder" on the General page. We recommend using an editor with YAML syntax highlighting (like VS Code). Click "Reload Config" in the client after saving your changes.
redir-host: Performs real DNS resolution locally before matching rules. Better compatibility but carries a risk of DNS leaks and adds latency to the first connection. Suitable for scenarios with specific IP requirements.
1. Check if the subscription link is complete and try opening it in a browser to verify accessibility;
2. Confirm the subscription hasn't expired;
3. If your network requires a proxy to access the subscription URL, enable "Update via Proxy" in the client settings;
4. Check the Log page for error messages to identify the specific issue.