does vpn protect you from hackers

A VPN can help to protect you from hackers on unsecured public WiFi networks.

Malicious hackers try to gain unauthorized access to or otherwise disrupt the operation of your computer, smartphone, or any other internet-connected device. 

While a virtual private network (VPN) is a great way to protect your privacy and security online, it’s not designed to defend you against hackers in all situations. We explain how and when a VPN can help to keep hackers at bay.

How does a VPN protect you from hackers?
Encrypting your internet
Hiding your IP address
What hackers does a VPN protect you against?
Man-in-the-middle attacks
Evil twins (malicious hotspots)
WiFi sniffing
DNS spoofing
Other remote attacks
What hackers does a VPN not prevent?
Get a trusted VPN and more to fight hackers

How does a VPN protect you from hackers?

A good VPN is an essential tool to protect your privacy and improve your overall security online. But it only helps to defend against specific types of online attacks.

By encrypting your internet connection and hiding your IP address, a VPN can help to prevent hackers from exploiting unsecured networks or using your IP address to target you.

Encrypting your internet

With a VPN, all the traffic from your device is securely encrypted, so your internet service provider (ISP), mobile network, or public WiFi provider can’t see your traffic. Your DNS queries, or requests to visit websites, are also encrypted, so your ISP can’t see where you go online.

So if you’re using a VPN on public WiFi, any criminal that hacks into the network can’t monitor your online activity. But most websites and apps now use HTTPS(new window), which has significantly reduced the threat from public WiFi hackers, as we explain below.

Hiding your IP address

When you connect to a VPN, the original IP address assigned to you is hidden from public view. All anyone online can see is the address of the VPN server you’re connected to.

By hiding your original IP address, a VPN can prevent hackers from using it to remotely hack into or otherwise attack your device.

Let’s consider in more detail the types of hacking a VPN can help to prevent.

What hackers does a VPN protect you against?

Since a VPN encrypts all your internet traffic and hides your IP address, the main scenario where a VPN can defend you against hackers is on unsecured public WiFi networks. 

Some free public WiFi networks still use insecure encryption or lack a strong password(new window), so they’re vulnerable to attack: Hackers can break into the network and spy on you.

With a VPN switched on, the encrypted VPN tunnel between your device and the VPN keeps your online activity safe from hackers’ prying eyes.

Encrypted VPN tunnel showing how a VPN protects you from hackers on unsecured public WiFi

However, most websites now use HTTPS, which encrypts the traffic between your device and the website. As HTTPS secures the information you submit online, like personal or financial details, the risk from public WiFi hackers is much lower than it once was.

But HTTPS only encrypts the data you exchange with websites. It doesn’t hide which sites you visit, so a hacker could still monitor where you go online. Nor does it defend you against DNS spoofing (see below).

Man-in-the-middle attacks

In a man-in-the-middle (MITM) attack(new window), the hacker intercepts the traffic between your device and the WiFi router. That way, they can eavesdrop on what you do, for example, to steal your personal details or impersonate you online.

A VPN hides your internet activity, keeping you safe from attack. MITM attacks include evil twins, WiFi sniffing, and DNS spoofing.

Evil twins (malicious hotspots)

Looking to connect to free WiFi in a cafe one day, you might see several networks on your device: “Seattle_Starbucks_WiFi”, “Starbucks_WiFi”, or “FREE_Starbucks_WiFi”. Be careful, as one could be an “evil twin” malicious hotspot(new window) created by a hacker — connect, and all your data could be visible to them.

If you do fall for the evil twin, a VPN will hide your data from the intruder.

WiFi sniffing

One way hackers can exploit unsecured networks is to use specialist software to “sniff out” data packets and analyze them. With a packet sniffer(new window), they could monitor your internet traffic and even hijack your cookies(new window) to impersonate you online and access your bank (to give a worst-case example).

With your VPN on, your data and real IP address are encrypted and can’t be sniffed.

Get Proton VPN!

DNS spoofing

When you enter a website address in your browser, it sends a DNS query to your ISP to look up the website’s correct numerical IP address. Unfortunately, these DNS requests, which can expose your entire browsing history, are typically unencrypted. If a hacker spoofs or “poisons” your DNS requests, they can redirect you to a malicious site they control.

A good VPN handles and encrypts all your DNS requests, meaning hackers can’t tamper with them. 

Other remote attacks

As a VPN hides your real IP address, it can also shield you from various attacks that exploit your IP address, whatever network you’re on.

For example, if hackers know your IP address, they can scan the ports(new window) on your device to spot weaknesses or target you with a denial-of-service (DoS or DDoS)(new window) attack.

What hackers does a VPN not prevent?

Apart from exploiting unsecured public WiFi, hackers can use various ways to access or damage your online devices. Here are some threats a VPN won’t stop.


Hackers can use all kinds of malware to access your device, like spyware(new window), rootkits(new window), and remote access Trojans(new window). A VPN isn’t designed as a primary line of defense against malware.

But some good VPNs like Proton VPN can give you some protection. Get Proton VPN Plus, and you can enable NetShield Ad-blocker to block some malware from ever reaching your device.

Still, a VPN is no substitute for antivirus or internet security software, which actively monitors and scans your device for malware. Install antivirus software on your devices and keep it updated.

Software vulnerabilities

A VPN can’t protect you against hackers attacking weaknesses in your apps or operating system. These range from known vulnerabilities, for which security patches may be available, to so-called zero days(new window), which aren’t known to product developers and have no fixes.

To minimize the risk from known threats, keep your apps, operating system, and antivirus definitions updated to the latest versions. 

Human error 

One of the easiest ways criminals can hack your device is with your help. If you don’t lock down your online accounts with strong passwords(new window) and two-factor authentication (2FA)(new window) where possible, you’re putting yourself at risk of being hacked.

Hackers can also use social engineering(new window) to trick you into disclosing confidential information or taking action that could compromise your device.

A VPN is no defense if you follow a link in a phishing email(new window) or download malicious software from an unauthorized website.

Get a trusted VPN and more to fight hackers

A VPN is a great tool to protect your privacy and security online, but it’s only a defense against certain kinds of hacking. As a VPN encrypts your internet connection and hides your IP address, it can help to protect you against public WiFi hackers or anyone using your IP address to attack you.

So a good VPN is just one weapon in your armory against hackers, along with these basic precautions:

  • Use strong passwords and two-factor authentication (2FA).
  • Install antivirus or malware removal software.
  • Beware of phishing, and be careful what you download.
  • Keep your operating systems, apps, and antivirus updated.

Remember that a VPN provider can see your online activity and could itself be hacked, so choosing  a VPN you can trust is vital. Proton VPN is trusted by millions worldwide, including journalists and activists, because we designed it to be as private and secure as possible. 

At Proton, our goal is to give everyone privacy and security online, so join us. Together, we can build a better internet where privacy is the default.

Learn more about what a VPN protects you from

Protect your privacy and security online
Get Proton VPN free

Related articles

Paris Olympics
The 2024 Summer Olympics in Paris begins this July. While you’ve likely already missed your chance to get a ticket and witness the best athletes from around the world in person, there are plenty of ways to enjoy the games from the comfort of your hom
Where to watch euros
Every four years, the entire continent of Europe turns its eyes to see who will be crowned as the continent’s champion of football (or soccer for the Americans).  This is the 17th edition of the UEFA European Football Championship, in which 24 natio
How to enable location services
Location services refer to a combination of technologies used in devices like smartphones and computers that use data from your device’s GPS, WiFi, mobile (cellular networks), and sometimes even Bluetooth connections to determine and track your geogr
What is AirTag stalking?
In an era of “smart devices” that often double as spy devices, AirTags are tracking tools that are open about their function and can be vital in helping locate lost items (as anyone who has lost their car keys can attest to). However, as a recent cla
How to fix a "Your connection is not safe" error
As you surf the web using your browser, you’ll no doubt encounter websites that your browser will refuse to load, instead showing some variation of an error message, such as Your connection is not private or Warning: Potential Security Risk Ahead. 
Your search history is a window into your inner life. Anyone with access to it knows what your hobbies and interests are, your sexual orientation and preferences, the things that worry you (for example your medical concerns), your political affiliati