TL;DR
Your computer thinks a website’s address is wrong, which could mean someone is trying to trick you. This guide shows how to check and fix it.
What’s happening?
A Hostname Mismatch error means the name your browser uses to find a website (like www.example.com) doesn’t match the actual address the server presents (its IP address). This can happen for several reasons, including:
- Incorrect DNS settings
- Your hosts file being modified
- A problem with your browser’s cache
- Man-in-the-Middle attack (less common but serious)
How to fix it
- Clear Your Browser Cache
- Most browsers store website information. Clearing this can resolve outdated or incorrect entries.
- Chrome: Press Ctrl+Shift+Delete (or Cmd+Shift+Delete on Mac). Select ‘Cached images and files’ and click ‘Clear data’.
- Firefox: Press Ctrl+Shift+Delete. Select ‘Cache’ and click ‘Clear Now’.
- Edge: Press Ctrl+Shift+Delete. Select ‘Cached images and files’ and click ‘Clear now’.
- Most browsers store website information. Clearing this can resolve outdated or incorrect entries.
- Flush Your DNS Cache
Your computer stores recently used website addresses to speed things up. Sometimes this cache gets corrupted.
- Windows: Open Command Prompt as an administrator (search for ‘cmd’, right-click, and select ‘Run as administrator’). Type
ipconfig /flushdnsand press Enter.ipconfig /flushdns - macOS: Open Terminal (Applications > Utilities). Type
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderand press Enter. You’ll need to enter your password.sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - Linux: The command varies depending on your distribution. Common commands include
sudo systemd-resolve --flush-cachesorsudo /etc/init.d/networking restart.
- Windows: Open Command Prompt as an administrator (search for ‘cmd’, right-click, and select ‘Run as administrator’). Type
- Check Your Hosts File
The hosts file maps website names to IP addresses directly. If it’s been altered, it can cause mismatches.
- Windows: Open Notepad as an administrator (search for ‘notepad’, right-click, and select ‘Run as administrator’). Open the file
C:WindowsSystem32driversetchosts.Look for any unusual entries. Comment them out by adding a ‘#’ at the beginning of the line.
- macOS/Linux: Open Terminal. Type
sudo nano /etc/hostsand press Enter. You’ll need your password.Look for any unusual entries. Comment them out by adding a ‘#’ at the beginning of the line.
- Windows: Open Notepad as an administrator (search for ‘notepad’, right-click, and select ‘Run as administrator’). Open the file
- Verify DNS Server Settings
Your internet service provider (ISP) usually provides DNS servers automatically. Sometimes, these can be unreliable. Consider using public DNS servers like Google’s or Cloudflare’s.
- Windows: Go to Network and Sharing Center > Change adapter settings. Right-click your network connection and select ‘Properties’. Select ‘Internet Protocol Version 4 (TCP/IPv4)’ and click ‘Properties’. Select ‘Use the following DNS server addresses’ and enter:
- Preferred DNS server:
8.8.8.8 - Alternate DNS server:
8.8.4.4(Google) or1.1.1.1(Cloudflare)
- Preferred DNS server:
- macOS: Go to System Preferences > Network. Select your network connection and click ‘Advanced’. Go to the ‘DNS’ tab. Add DNS servers using the ‘+’ button:
8.8.8.88.8.4.4(Google) or1.1.1.1(Cloudflare)
- Windows: Go to Network and Sharing Center > Change adapter settings. Right-click your network connection and select ‘Properties’. Select ‘Internet Protocol Version 4 (TCP/IPv4)’ and click ‘Properties’. Select ‘Use the following DNS server addresses’ and enter:
- Check for Malware
Malware can sometimes modify system files like the hosts file. Run a full scan with your antivirus software.
- cyber security Check: SSL Certificate
If you’re seeing this error on an HTTPS website (the address starts with
https://), it could indicate a problem with the website’s SSL certificate. Most browsers will show a clear warning if the certificate is invalid or expired.

