How to open an .ovpn file on Windows, Mac, Linux, Android and iPhone

An .ovpn file holds the settings of an OpenVPN connection. It isn't opened like a document: you import it into a VPN app. On Windows that is OpenVPN GUI, OpenVPN Connect or Veli, on a Mac Tunnelblick or OpenVPN Connect, on Linux the openvpn package, NetworkManager or Veli, on Android and iPhone OpenVPN Connect. If the app complains about a missing ca.crt or client.key, the keys lie next to the file rather than inside it: keep them in the same folder or paste them into the file.

Updated

.ovpn file: build, split and check it

An .ovpn file in Veli: Windows and Linux. Profiles → Add → “Open a file”, or drop the .ovpn into the window, or paste its text.

Download Veli for free
On this page

What opens an .ovpn file on each system

The same file works everywhere, you don't need a separate one per system. Give each device its own file, though: with one certificate on two devices the server usually drops the first when the second connects.

  • Windows

    AppOpenVPN GUI, part of the OpenVPN installer

    How to add the fileRight-click its icon near the clock → Import → “Import file…”. Or put the file into C:\Users\you\OpenVPN\config

  • Windows and macOS

    AppOpenVPN Connect

    How to add the fileDouble-click the file or drag it into the app's window, then OK

  • macOS

    AppTunnelblick

    How to add the fileStart Tunnelblick and drag the file onto its icon in the menu bar

  • Linux, terminal

    AppThe openvpn package

    How to add the filesudo openvpn --config client.ovpn

  • Linux, desktop

    AppNetworkManager with its OpenVPN plugin

    How to add the filenmcli connection import type openvpn file client.ovpn, or add a VPN from a file in the network settings

  • Android

    AppOpenVPN Connect

    How to add the fileMenu → My Profiles → the add icon → Upload File

  • Android

    AppOpenVPN for Android

    How to add the fileImport the .ovpn. If it names other files, the app asks you to pick them

  • iPhone and iPad

    AppOpenVPN Connect

    How to add the fileThe same Upload File: the file can lie in iCloud or another cloud. From a Mac: Finder → iPhone → Files → drag it onto OpenVPN

  • Windows and Linux

    AppVeli

    How to add the fileProfiles → Add → “Open a file”, or drop the file into the window

What is inside

An .ovpn is plain text, so any text editor shows it. Treat it as a password: with the keys inside, whoever has the file can connect as you. That is also why it should not go into online “viewers” and converters.

  • remote vpn.example.com 1194 is the server's address and port. There can be several such lines: the app tries them in turn.
  • proto udp or proto tcp is the transport. It must be the one the server uses.
  • dev tun or dev tap is the kind of tunnel. TUN is the usual one; TAP, a network bridge, is not supported by OpenVPN Connect and by apps on Android and iPhone.
  • <ca>, <cert>, <key>, <tls-auth> or <tls-crypt> are the certificates and keys. If instead there are lines such as ca ca.crt, they are in separate files.
  • auth-user-pass means the server also wants a login and a password.

From the terminal

Useful when you want to see the whole log. Initialization Sequence Completed in it means the tunnel is up; Ctrl+C disconnects.

Linux: Debian and Ubuntu
sudo apt install openvpn
sudo openvpn --config client.ovpn

Run it from the folder the file is in: the names of other files in it are read relative to that folder.

Linux: NetworkManager
sudo apt install network-manager-openvpn-gnome
nmcli connection import type openvpn file client.ovpn
nmcli --ask connection up client

The connection takes the file's name. --ask lets it ask for a password.

Windows: PowerShell as administrator
& "C:\Program Files\OpenVPN\bin\openvpn.exe" --config C:\Users\you\Downloads\client.ovpn
macOS: Terminal, OpenVPN from Homebrew
brew install openvpn
sudo "$(brew --prefix)/sbin/openvpn" --config client.ovpn

The file asks for ca.crt, client.crt, client.key or ta.key

Lines like ca ca.crt mean the keys were given to you as separate files, usually in one archive with the .ovpn. The app looks for them next to the .ovpn. OpenVPN GUI's “Import file…” copies only the .ovpn itself, into C:\Users\you\OpenVPN\config\client\: put the other files into that folder by hand. On a phone it is easier to make a single file, because the app often can't reach the neighbouring ones.

A single file looks like this. Open ca.crt and the others in a text editor, paste each whole between its tags and delete the lines that named the files. For tls-auth ta.key 1 the number moves to a line of its own, key-direction 1; with no number there is no such line, except in OpenVPN Connect, which wants key-direction bidirectional then.

client.ovpn
client
dev tun
proto udp
remote vpn.example.com 1194
nobind
remote-cert-tls server
<ca>
-----BEGIN CERTIFICATE-----
...ca.crt...
-----END CERTIFICATE-----
</ca>
<cert>
-----BEGIN CERTIFICATE-----
...client.crt...
-----END CERTIFICATE-----
</cert>
<key>
-----BEGIN PRIVATE KEY-----
...client.key...
-----END PRIVATE KEY-----
</key>
key-direction 1
<tls-auth>
-----BEGIN OpenVPN Static key V1-----
...ta.key...
-----END OpenVPN Static key V1-----
</tls-auth>

For tls-crypt ta.key the block is <tls-crypt>, and no key-direction is needed. Save the file as plain text in UTF-8: OpenVPN Connect takes profiles under 256 KB.

Login and password

  • The app asks by itself. With auth-user-pass in the file, it shows a login and a password field when it connects. They are not the account on the provider's site: many services give separate ones for OpenVPN.
  • To save them in a file, write auth-user-pass pass.txt and put the login on the first line of pass.txt and the password on the second. The password then lies on the disk as it is.
  • A passphrase for the key is a different thing: the private key itself is encrypted, and the passphrase came from whoever made the file.
  • A one-time code usually goes after the password or into a separate question, as the server wants it.
  • No certificate at all, only a login? OpenVPN Connect needs setenv CLIENT_CERT 0 in such a file, or it looks for a certificate that isn't there.

The file won't open or connect

  • Options error: --ca fails with 'ca.crt': No such file or directory (errno=2)

    CauseThe keys are in separate files, and the file isn't there

    What to doPut ca.crt and the rest next to the .ovpn, or paste them inside

  • You must define CA file (--ca) or CA path (--capath)

    CauseNo certificate of the server's authority in the file

    What to doAsk whoever made the file for a full one

  • No client-side authentication method is specified

    CauseNeither a certificate with a key nor auth-user-pass

    What to doThe same: the file is incomplete

  • Unrecognized option or missing or extra parameter(s) in client.ovpn:20

    CauseThe line with this number is unknown to this version. On Linux and macOS it is often block-outside-dns, a Windows option

    What to doDelete that line, or update OpenVPN if the option is new

  • OSI layer 2 tunnels are not currently supported

    CauseThe file has dev tap, and OpenVPN Connect is built without TAP

    What to doUse OpenVPN itself on a computer, or ask for a dev tun file

  • AUTH_FAILED

    CauseThe server refused the login, the password or the certificate

    What to doCheck which login the service wants; if it's right, the access may have expired

  • TLS key negotiation failed to occur within 60 seconds

    CauseNo answer from the server

    What to doA separate guide has the causes

  • The file opens in Notepad or a browser

    CauseNo app is linked with .ovpn

    What to doImport it from inside the VPN app

What an .ovpn file can't do

  • Work without the server. The file is only an address and keys. If the server is off or the access has ended, no app will connect.
  • Become a WireGuard file. The protocols have different keys, so a converter can't help.
  • Hide. OpenVPN is easy to recognise, and networks that filter VPNs cut it early. proto tcp on port 443 helps against closed ports, not against recognition.

Sources

How we write and check

In Veli

An .ovpn file in Veli: Windows and Linux

Profiles → Add → “Open a file”, or drop the .ovpn into the window, or paste its text. If the server wants a login, Home shows “Username (if required)” and Password, with “Remember (stored encrypted)”. On Windows the app downloads OpenVPN itself when a profile needs it; on Linux it runs the openvpn package of your system. On macOS and Android Veli doesn't connect OpenVPN: the app says so, and there you need one of the apps above.

Veli takes the .ovpn alone, so the keys have to be inside it. It also doesn't run what a file could start as administrator: with plugin or your own up and down scripts in it, the profile is refused and the message names the setting. Harmless leftovers such as script-security 2 or user nobody are simply skipped. DNS from the server works without any scripts.

FAQ

Can I open an .ovpn file online?

There is nothing to open online: a web page can't bring up the tunnel, and it would get your private key. Look inside with a text editor and connect with an app.

How do I open an .ovpn file on iPhone?

With OpenVPN Connect: keep the file in iCloud or another cloud and choose Upload File on the Import Profile screen, or drag it to the app's folder in Finder on a Mac. iOS itself can't import .ovpn.

Does Windows 11 open .ovpn files without other programs?

No. The VPN built into Windows doesn't know OpenVPN, so you need a client.

Where is the private key in the .ovpn file?

Between <key> and </key>. If that block isn't there, look for a line starting with key and the name of a separate file, or for pkcs12.

What is the difference between .ovpn and .conf?

For OpenVPN none: it is the same text, .conf is the usual name on Linux. But WireGuard files are .conf too: if you see [Interface] and [Peer] inside, it is WireGuard.

Drop the .ovpn into the window

Veli is a free client. On Windows and Linux it connects OpenVPN files next to WireGuard, AmneziaWG and VLESS, with the login stored encrypted.