Switch hosts configurations with one click across dev, test, and production environments. This free, open-source, cross-platform tool simplifies DNS setup and boosts productivity.
✨ One-click switching between development, testing, and production environments — say goodbye to tedious DNS configuration!
In web development, testing, or network debugging, we often need to modify the hosts file to point domain names to different IP addresses. Traditional manual editing is both cumbersome and error-prone. SwitchHosts perfectly solves this pain point. It's a free, open-source, cross-platform hosts management tool that lets you easily manage and quickly switch between multiple hosts configurations.
📖 What is SwitchHosts?
SwitchHosts is a powerful hosts resolution management tool that allows you to conveniently manage, edit, and quickly switch between multiple hosts configuration schemes. Whether you work on Windows, macOS, or Linux, SwitchHosts delivers a consistent and efficient experience.
For developers and testers who frequently switch between different network environments, SwitchHosts acts as a professional hosts housekeeper, helping you organize chaotic hosts configurations in perfect order.
🚀 Features: Why Choose SwitchHosts?
🎨 Intuitive Syntax Highlighting
When editing hosts files, SwitchHosts provides clear syntax highlighting, displaying IP addresses, domain names, and comments in different colors, greatly improving readability and editing efficiency.
⚡ One-Click Quick Switching
Switch between different hosts schemes quickly via the system tray icon, without manually opening the file for editing. You can create independent configurations for development, testing, production, and other environments — switch with just one click.
🌐 Remote Hosts Support
SwitchHosts supports reading hosts content from specified URL addresses. This feature is especially useful for team collaboration — just maintain one remote hosts configuration, and all team members will automatically sync updates.
🔢 Quick Comment via Line Numbers
When editing hosts, simply click on a line number to quickly comment or uncomment a rule. This small but thoughtful feature is extremely convenient in actual use.
💻 Comprehensive Multi-Platform Support
Built on the Electron framework, SwitchHosts fully supports Windows, macOS, and Linux operating systems, delivering a consistent experience across different devices.
📤 Data Import and Export
Supports importing and exporting hosts configurations, making it easy to back up and share your configuration schemes.
⌨️ Alfred Integration (macOS)
On macOS, SwitchHosts also supports Alfred workflow, allowing you to quickly switch hosts schemes via keyboard shortcuts.
💡 Core Use Cases
🛠️ Web Development and Testing
For full-stack developers, it's common to point the same domain name to local development environments, test servers, or production servers. With SwitchHosts, simply pre-configure hosts schemes for different environments and switch with one click, dramatically improving work efficiency.
🔍 Network Debugging and Optimization
When you need to test website access across different CDN nodes, or point specific domain names to optimized IP routes, SwitchHosts makes these operations simple and fast.
🚀 Access Optimization and Ad Blocking
By configuring specific hosts rules, you can optimize access speeds to certain websites or block ad domains. SwitchHosts' remote hosts feature lets you easily subscribe to and auto-update these rules.
📂 Multi-Project Parallel Development
When you need to handle multiple projects simultaneously, each with unique domain resolution requirements, SwitchHosts helps you maintain independence across environments, avoiding mutual interference.
🛠️ Detailed Usage Guide
📝 Basic Configuration and Usage
- Add Local Hosts Scheme
Open SwitchHosts, click the "+" button in the top-left corner, select "Local" type, enter a scheme name, then edit your hosts rules in the content area. Each scheme has an independent toggle, allowing you to enable or disable it anytime. - Use Remote Hosts Scheme
Click the "+" button and select "Remote" type, enter a title and URL address, and set the auto-update interval. SwitchHosts will periodically fetch the latest hosts content from that URL. For example, you can add a GitHub acceleration hosts subscription:
https://raw.hellogithub.com/hosts- Combine Multiple Schemes
SwitchHosts allows you to enable multiple hosts schemes simultaneously; it will automatically merge them and apply them to the system. You can flexibly combine different schemes as needed.
🎯 Advanced Usage Tips
🔄 Manage Remote Hosts with GitHub
You can create a repository on GitHub to store your hosts configuration, then add it as a remote scheme in SwitchHosts via the Raw link. Specific steps:
- 📁 Create a new repository on GitHub and add a hosts file
- 📝 Add rules in the format of IP + space + domain name
- 🔗 Click the "Raw" button to get the raw file link
- ⚙️ Add a remote scheme in SwitchHosts and fill in the Raw link
This way you can access the same hosts configuration anywhere, perfect for multi-device sync.
🗂️ Organize Complex Hosts Rules
When there are many rules, you can maintain organization through group comments:
# ===== Development Environment =====
127.0.0.1 local.dev.com
192.168.1.100 api.dev.com
# ===== Testing Environment =====
192.168.1.200 test.example.com🔐 Resolve Permission Issues
On some systems, you may encounter permission issues writing to the hosts file. Solutions:
- Windows: Find the
C:\Windows\System32\drivers\etc\hostsfile, right-click and select Properties, uncheck the "Read-only" option, or add write permissions to the Users group in the Security tab. - macOS/Linux: SwitchHosts will prompt you to enter your administrator password when needed.
⚡ Common Issue Resolution
🔄 Hosts Modifications Not Taking Effect
This is caused by DNS cache and can be resolved by:
- Windows: Run
ipconfig /flushdnsin the command line - macOS: Run
sudo killall -HUP mDNSResponder - Chrome Browser: Visit
chrome://net-internals/#dnsand click the "Clear host cache" button
🖥️ SwitchHosts Interface Not Displaying
If SwitchHosts is running in Task Manager but the interface doesn't show, it may be due to character set issues in the hosts file causing garbled text. Try fixing the hosts file encoding or removing the garbled content.
🔗 Conflict with Proxy Tools
If you use proxy tools, you may find that hosts modifications don't take effect because proxy tools override hosts settings. The solution is to temporarily disable proxy tools when testing SwitchHosts.
🔄 Comparison with Similar Tools
While there are other hosts management tools like Multiple-host, Hozz, and browser extensions like Switch host plus, SwitchHosts excels in the following aspects:
✅ Feature Completeness
Compared to other tools, SwitchHosts supports both local and remote schemes, offers syntax highlighting and quick commenting, providing the most complete hosts management experience.
👍 User Experience
SwitchHosts features an intuitive interface with clear operational logic — even first-time users can get started quickly.
🛡️ Stability and Updates
As a popular open-source project on GitHub, SwitchHosts is continuously maintained and updated, with active community support.
🔄 Cross-Platform Consistency
SwitchHosts delivers nearly identical features and experience across different operating systems, which is critical for developers working across multiple platforms.
In contrast, browser extensions only affect browser behavior, while SwitchHosts is a system-level solution. Other desktop tools like Hozz have poor cross-platform compatibility.
📥 Download, Installation, and Deployment
📲 Official Download Channels
Download the installation package for your platform from the SwitchHosts official website or GitHub.
Installation packages are available for all systems. Windows users select SwitchHosts_windows_installer_x64_*.*.*.exe, macOS users select the .dmg file, and Linux users can choose .AppImage or .deb files.
📦 Package Manager Installation
For users who prefer package managers, installation is also available through:
- macOS: Install via Homebrew
brew install --cask switchhosts- Windows: Install via Scoop
scoop install switchhosts⚙️ Post-Installation Configuration
After running SwitchHosts for the first time, we recommend:
- 🈯 Select your preferred language in settings (Chinese supported)
- 🔄 Adjust the auto-update interval according to your habits
- 🖱️ Familiarize yourself with using the system tray icon
💎 Summary
With its powerful features, clean interface, and stable performance, SwitchHosts has become the ultimate choice for managing hosts configurations. Whether you're a web developer who frequently switches environments or a technician who needs fine-grained network debugging, SwitchHosts can significantly boost your work efficiency.
Its remote sync feature makes team collaboration effortless, while cross-platform support ensures a consistent experience across devices. Best of all, as open-source software, SwitchHosts is transparent and secure — no security concerns.
If you're still manually editing hosts files or dissatisfied with your current hosts management tool, give SwitchHosts a try and experience a new, efficient, and convenient way to manage hosts!
Related Resources:
- 🌐 Official Website: https://switchhosts.vercel.app/
- 🔧 GitHub Repository: https://github.com/oldj/SwitchHosts
- 📚 Documentation: https://github.com/oldj/SwitchHosts/blob/master/README.zh_hans.md
Note: This is the English translation of the original Chinese version.