Short answer: how does a VPN work? Your device builds an encrypted tunnel to a VPN company server, and your traffic travels through it. Websites see the server’s address instead of yours, and your provider sees only a scrambled connection to the server, not the sites you visit.

This article answers two questions: what is a VPN, and how does a VPN work? It also compares WireGuard and OpenVPN, the two protocols most VPN apps offer, and ends with the part most guides skip: the cases where a VPN adds nothing at all.

Key Takeaways

  • How does a VPN work? It builds an encrypted tunnel from your device to a VPN server, so websites see the server’s address, not yours.
  • What is a VPN? A service that moves the view of your browsing from your internet provider to the VPN company. It changes who can see your traffic; it does not remove that watcher.
  • WireGuard vs OpenVPN: WireGuard is about 4,000 lines of code with one fixed cipher set; OpenVPN is about 70,000 lines with a menu of ciphers. WireGuard is the better default; OpenVPN is the fallback when a network blocks it.
  • A VPN does not make you anonymous. Cookies, logins and fingerprinting still recognise you, and a VPN does not stop phishing or malware.
  • In India, VPNs are legal for individuals. The 2022 CERT-In directions make VPN providers keep customer records for five years; several large providers removed their physical servers from India in response.

What Is a VPN?

What is a VPN? It is software that sends your internet traffic through an encrypted tunnel to a server run by the VPN company, instead of straight to the website you want. VPN stands for virtual private network: “virtual” because there is no private cable, the tunnel is built with encryption over the public internet; “private” because only your device and the VPN server can read what travels inside it.

Two kinds exist. A work VPN connects you to your office network from home; a consumer VPN connects you to the open internet through a server elsewhere, so sites see the server, not you. IT sets up the first; you buy the second.

A VPN has one job: it changes who can see your internet traffic. Before one, your provider and anyone on your local network can see which sites you connect to. After one, they see only an encrypted connection to one server. The VPN company takes the provider’s place as the watcher, which is why choosing a provider you trust matters more than any feature list.

How Does a VPN Work?

How does a VPN work? It encrypts your traffic, sends it through a tunnel to a VPN server, and swaps your IP address for the server’s. Four things happen every time you switch it on.

Step 1: Your device builds an encrypted tunnel

When you connect, your device and the VPN server agree on encryption keys and open a tunnel between them. Everything you send is scrambled before it leaves your device. Anyone watching the local network, a cafe Wi-Fi or your internet provider sees encrypted data going to one address and nothing else. The encryption is the same kind of maths that protects online banking: ChaCha20-Poly1305 for WireGuard, usually AES-256-GCM for OpenVPN.

Step 2: The VPN server becomes your exit

Your traffic travels through the tunnel and comes out at the VPN server, which sends your request to the website using its own IP address. The website answers the server, and the server sends the answer back through the tunnel to you. That is why a website sees the server’s location instead of yours, and why a VPN can make it look as if you are browsing from another city or country.

Step 3: Your DNS requests go through the tunnel too

Before your browser can open a site, it asks a DNS server to turn the site’s name into an address. Without a VPN, that question usually goes to your internet provider, which can log it. A good VPN app sends DNS requests through the tunnel to the VPN company’s own resolver. If it fails to do this, the leak is called a DNS leak: the provider can still see which domains you look up, even while the rest of your traffic is hidden.

Step 4: The kill switch guards the tunnel

If the tunnel drops, for example when your Wi-Fi reconnects, the kill switch blocks all internet traffic until the tunnel is back. Without it, your device quietly sends traffic over the open connection, and the protection is gone without warning. Any VPN worth using has a kill switch, and it should be switched on.

How does a VPN work in four steps: encrypt, tunnel, swap IP address, browse.

What Does a VPN Hide, and What Does It Not Hide?

How does a VPN work against tracking? It changes your IP address, not your identity. The table below shows who sees what.

Who is watchingWithout a VPNWith a VPN
Your Wi-Fi network (home, cafe, hotel)Which sites you connect toOnly that you use a VPN, how much data, and when
Your internet providerWhich sites you connect to; your real IP addressOnly the connection to the VPN server and data volume
The VPN companyNothing; it is not involvedYour real IP address and the sites you connect to
Websites and apps you useYour real IP address and everything you do on the siteThe VPN server’s IP address and everything you do on the site
Advertisers and trackersCookies, logins, fingerprint, IP addressCookies, logins, fingerprint; only the IP changes
Malware, phishing and scam sitesThey work as usualThey still work; a VPN is not antivirus

Three rows matter most. First, the VPN company: it sees your real IP address and the sites you connect to, the view your provider had before. A “no-logs” promise is only as good as the audits behind it, so a provider never independently audited is asking you to take its word for it. Second, logins: the moment you sign in to Google, Facebook or your bank, the site knows it is you, VPN or not.

Third, phishing: a VPN does not check links or files, and a fake login page works exactly the same through one. That is why checking a link before you click it still matters. Our guide on how to check if a link is safe before clicking explains what to look for. A VPN also does not hide your GPS location: it comes from GPS and nearby networks, not your IP address.

WireGuard vs OpenVPN: Which Is Better?

WireGuard is the better default. How does a VPN work at the protocol level? The app and the server need shared rules for building the tunnel: how to agree on keys, which cipher scrambles the data, and how to recover lost packets. WireGuard, a modern VPN protocol written by Jason Donenfeld in 2016, and OpenVPN, an older protocol written by James Yonan in 2001, are the two rulebooks almost every consumer VPN app offers, and they take opposite approaches.

WireGuardOpenVPN
First released2016; in the Linux kernel since 5.6 (March 2020)2001
Code sizeUnder 4,000 lines (excluding crypto primitives)Around 70,000 lines, plus OpenSSL
CryptographyOne fixed set: ChaCha20-Poly1305, Curve25519, BLAKE2sNegotiated; defaults AES-256-GCM, AES-128-GCM, ChaCha20-Poly1305
TransportUDP onlyUDP or TCP
Default portUDP 51820 by conventionUDP 1194; TCP 443 as an option
HandshakeOne round trip; no negotiationTLS handshake with cipher negotiation
Audits and verificationFormally verified; Cure53 audit, 2019Quarkslab audit, 2017; no backdoors found
Runs inIn the Linux kernelUser space; kernel offload in 2.7
Best forEveryday use, phones, fast reconnectsNetworks that block VPNs, offices, restrictive Wi-Fi

WireGuard: small, fast and fixed

How does a VPN work with WireGuard? The app opens a tunnel using one fixed set of cryptography: ChaCha20 for encryption, Poly1305 for authentication, Curve25519 for the key exchange and BLAKE2s for hashing. There is nothing to negotiate and nothing to misconfigure. The Linux implementation is under 4,000 lines of code, not counting the cryptographic primitives, according to the WireGuard whitepaper, so it is small enough to audit properly.

The protocol has also been formally verified, by Donenfeld and Milner (formal verification paper) and in a machine-checked proof published by INRIA researchers in May 2019, and the Linux implementation was audited by Cure53 in 2019.

Running inside the Linux kernel, WireGuard is usually faster than OpenVPN and reconnects in a fraction of a second when you switch networks, which is why it is the best choice on a phone. Its limit is rigidity: UDP only, on the conventional port 51820, so a network that blocks UDP blocks it, and its cryptography cannot be reconfigured if a cipher ever weakens.

OpenVPN: flexible and battle-tested

How does a VPN work with OpenVPN? The app sets up the tunnel with TLS, the technology behind HTTPS, then encrypts traffic with a negotiated cipher. The defaults in OpenVPN 2.6 and later are AES-256-GCM, AES-128-GCM and ChaCha20-Poly1305 where the build supports it. OpenVPN’s own code is around 70,000 lines, plus the OpenSSL library on top, so there is far more code to trust than WireGuard’s 4,000.

That size buys flexibility. OpenVPN can run over UDP on port 1194, the port assigned to it, or over TCP on port 443, the port normal web traffic uses, so it can pass as ordinary browsing on networks that block VPNs.

Its track record is long: a 2017 audit by Quarkslab and Cryptography Engineering, funded by the Open Source Technology Improvement Fund, examined OpenVPN 2.4.0 and found no backdoors or design flaws, only denial-of-service bugs fixed in versions 2.4.2 and 2.3.15 (audit report). OpenVPN 2.7, released in February 2026, added Data Channel Offload, which moves encryption into the kernel and narrows the speed gap with WireGuard.

WireGuard vs OpenVPN: which one should you pick?

Use WireGuard as the default. It is faster, simpler and easier to audit, and most good VPN apps already select it for you. Switch to OpenVPN when a network blocks WireGuard, for example hotel, school or office Wi-Fi that drops UDP traffic, or when you need TCP on port 443 to get through. If your app offers both, you do not need to think about it: WireGuard for normal use, OpenVPN for stubborn networks.

WireGuard vs OpenVPN: WireGuard is minimal and fast, OpenVPN is mature and flexible.

When Do You NOT Need a VPN?

How does a VPN work for someone who only visits HTTPS sites at home? It adds almost nothing. A VPN is a tool for a specific problem, and these are the cases where the problem is not there.

  • On your home Wi-Fi, doing ordinary browsing. Your home network is yours, and HTTPS already encrypts what you read and type. Your provider can still see which domains you visit, but a VPN only moves that view to the VPN company. If your worry is the provider, a VPN helps; if not, it adds little.
  • For banking and shopping. Your bank’s site uses HTTPS and its own fraud checks. A VPN does not make the login safer, and it can trigger extra checks because the bank sees an unfamiliar location. A strong, unique password and two-factor authentication do far more.
  • To stop phishing or malware. A VPN cannot tell a real bank email from a fake one, and it does not scan downloads. If a link looks suspicious, the VPN will happily carry you to the scam site. Link checking and a password manager are the tools for this, not a VPN. See our list of the best free password managers.
  • To be anonymous while logged in. A VPN hides your IP address, not your identity. Signed in to Google, YouTube or Facebook, those services know it is you. Real anonymity needs Tor and a different way of browsing, not a VPN subscription.
  • To fix a slow connection. A VPN adds a hop and encryption, so it usually makes a connection slightly slower, not faster. If your internet is slow, the VPN is not the fix; the connection is.
  • When the VPN itself is the risk. A free VPN has to make money somehow, and the usual way is your data: logs, tracking or selling browsing profiles. A free VPN that keeps logs gives you less privacy than no VPN at all.
When you do not need a VPN: home Wi-Fi with HTTPS already protects ordinary browsing.

VPNs in India: What the CERT-In Rules Mean for You

How does a VPN work under Indian rules? The same way. The rules change what VPN companies must store, not how the tunnel works. Using a VPN is legal for individuals in India; no law bans it, and CERT-In’s FAQ says individual citizens are not covered by its directions.

The directions, issued by CERT-In on 28 April 2022 under the Information Technology Act, apply to VPN providers that serve the public. They must keep customer records for five years: validated names, addresses and contact numbers, email addresses, the IP addresses allotted to customers, the period of hire and the purpose of hiring. The directions do not ask providers to record which websites you visit or what you do online. Providers must also report listed cyber incidents to CERT-In within six hours and keep their own system logs for 180 days.

Several large providers decided the five-year rule conflicted with their no-logs promise and removed their physical servers from India in June 2022, including ExpressVPN, Surfshark and NordVPN. They replaced them with virtual Indian locations: servers in nearby countries, such as Singapore and the UK, that give you an Indian IP address. NordVPN added a virtual India location in January 2024.

So an “India” server in a VPN app today is usually virtual, not hardware in India, so the traffic is not stored under the Indian directions. A provider that still runs physical servers in India must follow the five-year rule.

How to Choose a VPN

Pick a provider with independent audits, both protocols, and a kill switch that is on by default.

  • Independent audits, not promises. Pick a provider whose no-logs policy and apps have been checked by an outside auditor, and read the audit, not just the claim on the pricing page.
  • WireGuard plus OpenVPN. The app should offer both, so WireGuard is the default and OpenVPN is there for stubborn networks.
  • A kill switch that is on by default. If the tunnel drops, your traffic must stop, not leak onto the open connection.
  • No lifetime deals from unknown brands. A VPN costs money to run. A lifetime plan for a few dollars is a promise the company cannot keep without selling something, and that something is usually your data.

FAQs

1. How does a VPN work in simple words?

How does a VPN work, in one sentence? It wraps your internet traffic in encryption and sends it to a server run by the VPN company. The server passes it to the website, so the website sees the server’s address, not yours.

2. What is a VPN?

What is a VPN, in one line? Software that sends your traffic through an encrypted tunnel to a VPN company’s server, so websites see the server and your provider sees only the tunnel.

3. Does a VPN hide my browsing history from my ISP?

Yes, mostly. Your provider sees only an encrypted connection to the VPN server and how much data you use. It cannot see which sites you visit. But the VPN company can, so the view moves, it does not disappear.

4. Does a VPN make me anonymous?

No. A VPN hides your IP address from websites, not your identity. Cookies, logins, browser fingerprinting and GPS still identify you. Real anonymity needs Tor, not a VPN.

5. Is WireGuard better than OpenVPN?

For most people, yes. WireGuard is faster, simpler and easier to audit, with about 4,000 lines of code against OpenVPN’s roughly 70,000. OpenVPN is the better choice only when a network blocks WireGuard, because it can run over TCP on port 443.

6. Is OpenVPN still safe in 2026?

Yes. OpenVPN’s encryption is still strong, it passed a 2017 independent audit that found no backdoors or design flaws, and version 2.7 added kernel offload for speed. It is older and heavier than WireGuard, not unsafe.

7. Are VPNs legal in India?

Yes, for individuals. No Indian law bans using a VPN, and CERT-In’s FAQ says individual citizens are not covered by its 2022 directions. The rules apply to VPN providers, which must keep customer records for five years.

8. What is a VPN kill switch?

A kill switch blocks all internet traffic if the VPN tunnel drops, so nothing leaks onto the open connection. It should be switched on, especially on public Wi-Fi.

9. Can a free VPN be trusted?

Usually not. Running a VPN costs money, and a free service usually pays for it with your data: logs, tracking or selling browsing profiles. A free VPN that logs gives you less privacy than no VPN at all.

10. Does a VPN protect me from hackers on public Wi-Fi?

Partly. It encrypts your traffic, so someone on the same network cannot read it. But it does not stop phishing, malware or fake hotspots. Check links before you click them, and keep your software updated.

Conclusion

How does a VPN work? A tunnel, a server swap and a trust swap. That is the whole trick. It hides your browsing from your provider and your IP address from websites, and it moves the trust to a company you chose. It does not hide you from the sites you log in to, it does not stop phishing or malware, and it does not make you anonymous.

Use WireGuard as the default and OpenVPN for stubborn networks. Pick a provider with real audits and a kill switch, and skip a VPN entirely when the risk is a password or a phishing link. A VPN is one layer, not the whole wall: keep your phone updated, use the Android security features on your device, and use a password manager.