Access Your Raspberry Pi Anywhere, Anytime with a Few Clicks and a Stable Connection

A step-by-step guide on how to remotely access your Raspberry Pi from a Windows computer using the VNC protocol and RealVNC Viewer. …


Updated September 20, 2023

Need help with your Raspberry Pi?
Contact Me!

Do you love silly Raspberry Pi Projects?
Check out my this YouTube Channel!


A step-by-step guide on how to remotely access your Raspberry Pi from a Windows computer using the VNC protocol and RealVNC Viewer.

Remote accessing your Raspberry Pi allows you to control it even when you’re not physically in front of it. This is especially useful if you have set up your Raspberry Pi as a server, development environment, or media center and want to check on its status or perform maintenance without having to be right next to it. In this article, we will show you how to use the VNC protocol and RealVNC Viewer to remotely access your Raspberry Pi from a Windows computer.

Step 1: Install VNC Server on Your Raspberry Pi

First, we need to install a VNC server on your Raspberry Pi. There are several options available, but in this guide, we will use the TightVNC server. Open a terminal window on your Raspberry Pi and run the following command:

sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install tightvncserver -y

This will download and install the latest version of TightVNC server. Once installation is complete, you can start the VNC server by running the following command:

tightvncserver :1

The :1 at the end specifies which display to use (in this case, we’re using the first one). You will be prompted to set a password for your VNC session. Choose something secure and make note of it, as you will need it later to connect from your Windows computer.

Step 2: Set Up Your Raspberry Pi for Remote Access

Before we can access our Raspberry Pi remotely, we need to ensure that it is accessible over the internet. Here are a few steps to make sure your Raspberry Pi has a public IP address and is configured to allow incoming connections:

  1. Check if your Raspberry Pi has a static IP address by running ifconfig in a terminal window. If it doesn’t, you can set one using the sudo nano /etc/dhcpcd.conf command and adding the following lines at the end of the file:

    interface eth0
    static ip_address=192.168.1.100/24
    static routers=192.168.1.1
    static domain_name_servers=8.8.8.8.8 8.8.4.4
    

    Replace 192.168.1.100 with your desired IP address and save the file by pressing Ctrl + X, then Y, and finally Enter. Reboot your Raspberry Pi for the changes to take effect: sudo reboot.

  2. Set up port forwarding on your router to allow incoming connections on port 5901 (the default VNC port). This will depend on your router’s model, but generally involves logging into your router’s admin panel and adding a new rule that forwards TCP traffic from an external port (e.g., 5901) to the internal IP address of your Raspberry Pi (192.168.1.100) on the same port.

Step 3: Install RealVNC Viewer on Your Windows Computer

Now that we have a VNC server set up on our Raspberry Pi, we need to install a VNC viewer on our Windows computer. Download and install RealVNC Viewer from the official website. Once installation is complete, launch the program.

Step 4: Connect to Your Raspberry Pi Using RealVNC Viewer

  1. In the RealVNC Viewer window, click on “File” > “New Connection”.
  2. Enter your Raspberry Pi’s public IP address in the “Enter a VNC Server address” field (e.g., 50.60.70.80:1). Replace 50.60.70.80 with your actual public IP address and :1 with the display number you specified when starting the VNC server on your Raspberry Pi.
  3. Click “Connect”. You will be prompted to enter the password you set earlier during the TightVNC installation process. Type it in and click “OK”.
  4. If everything is configured correctly, you should now see a remote desktop session of your Raspberry Pi on your Windows computer!

That’s it! Now you can remotely access your Raspberry Pi from any Windows computer with an internet connection. Just launch RealVNC Viewer and connect using the IP address and password you set up earlier. This is a great way to monitor your Raspberry Pi’s status or perform maintenance without being physically present.