vnc server (view raspberry from your windows)

Photo of author

By Jackson Taylor

Home » Electronics Topics » Raspberry Pi » vnc server (view raspberry from your windows)

As an Amazon Associate we earn from qualifying purchases.

VNC (Virtual Network Computing) lets you see and control the desktop of your Raspberry Pi from another computer. If you do not want a separate monitor, keyboard and mouse for the Pi, you can run a VNC server on it and connect from a Windows PC over your local network. This guide shows the full process, from installing the server to opening the connection in Windows.

Step 1 illustration

What you need before you start

  • A Raspberry Pi with Raspberry Pi OS (or another Debian-based system) already running.
  • Access to a terminal on the Pi, either with a screen and keyboard for the first setup or through SSH.
  • A Windows PC on the same network as the Pi. Both can be on the same router, over WiFi or Ethernet.
  • An internet connection on the Pi to download the VNC package.

If your Pi is not on the network yet, see how to configure WiFi on a Raspberry Pi first, or how to connect a Raspberry Pi to a laptop with a cable.

Step 1 – Install a VNC server on the Raspberry Pi

Installation screenshot

Open a terminal on the Raspberry Pi and run the following command to install TightVNC server:

Hardware Hack

Stop Buying New Batteries for Your Tech

Electronics are expensive, but their power sources don't have to be. Discover the simple engineering trick to recondition dead batteries and bring your gadgets back to 100% capacity.

Watch the Free Video
sudo apt-get install tightvncserver

It is a good idea to update your package list first with sudo apt-get update. Note that recent versions of Raspberry Pi OS already include a VNC server (RealVNC) that you can switch on in the configuration tool under the interface options. If the TightVNC package is not available on your system, use that built-in option instead and connect with a RealVNC-compatible viewer.

Step 2 – Run the VNC server on the Raspberry Pi

Run VNC server

Start the server from the terminal:

vncserver

If you want a full HD desktop, start it with a set screen size and color depth instead:

vncserver :1 -geometry 1920x1080 -depth 24

The :1 is the display number. You will need it when you connect from Windows. The -geometry option sets the resolution and -depth sets the color depth.

See also
FINDING RASPBERRY IP ADDRESS WITHOUT DISPLAY USING NMAP AND LOGIN WITH PUTTY in windows

Create the VNC password

The first time you run the server, the Pi asks you to create a VNC password. The maximum password length is 8 characters, so anything longer is cut off. Choose something you can remember, and do not reuse your Pi login password.

Step 3 – Find the IP address of the Raspberry Pi

IP address screenshot

Windows needs the Pi’s IP address to find it on the network. In the Pi terminal, type:

ifconfig

Look for the inet address under the network interface you are using. It is usually wlan0 for WiFi or eth0 for a cable. If the command is not found, hostname -I also prints the address.

If you have no screen attached to the Pi, you can still find the Raspberry Pi IP address without a display by scanning your network from Windows.

Step 4 – Download and install a VNC viewer on Windows

On the Windows PC you need a VNC client, often called a viewer. TightVNC Viewer and RealVNC Viewer both work with this setup. Download the installer from the official site of the program you choose, run it and follow the prompts. If you only need the viewer, you can skip installing the server part on Windows.

Step 5 – Open the VNC viewer and connect

Windows VNC client

Open the viewer on Windows and enter the Pi’s IP address followed by a colon and the display number you started the server with. For example:

Sustainable Tech

Keep Toxic E-Waste Out of Landfills

Don't throw away your failing laptop, phone, or car batteries. Learn how to recondition them at home in just a few hours. It's better for the planet—and your wallet.

Learn How It Works
192.168.137.30:1

Replace the example address with the one you found in step 3. If the address is correct, the viewer asks for a password. Enter the VNC password you created on the Raspberry Pi.

VNC connection confirmation

After a moment, the Raspberry Pi desktop appears in a window on your PC. You can now use your Windows mouse and keyboard to control the Pi.

Troubleshooting common problems

  • The connection times out: check that the Pi and the PC are on the same network and that the IP address is correct. The address can change after a reboot if your router assigns it automatically.
  • Connection refused: the server may not be running. Start it again with the vncserver command and make sure the display number matches what you typed in the viewer.
  • Password rejected: remember that only the first 8 characters count. You can set a new one with the vncpasswd command.
  • Grey or empty screen: this can happen when the desktop session does not start with the server. Check the startup file used by your VNC server and make sure it launches the desktop environment.
See also
PCB DESIGNING

Stop a VNC session

To shut down the server for display 1, run this on the Pi:

vncserver -kill :1

Keep your VNC connection safe

Basic VNC connections are not strongly encrypted, so use them on a trusted home or lab network. Do not expose the VNC port straight to the internet. Display :1 normally uses TCP port 5901. If you need access from elsewhere, tunnel the connection through SSH or use a VPN. For more on this, read how to reach your Pi from outside your home network.

Other ways to reach your Pi from Windows

VNC shows the real desktop of the Pi, which is useful for graphical tools. If you prefer a different method, you can use remote desktop from Windows with RDP, or use SSH for text-only work. To transfer files between Windows and Raspberry Pi, FTP or SFTP is usually easier than a VNC session. If you are setting up a direct cable link, our guide on how to connect a Raspberry Pi to a laptop covers the options.

FAQ

Do I need a monitor to use VNC with a Raspberry Pi?

You need a way to run the first commands, either a monitor and keyboard or an SSH connection. After the server is running, you do not need a monitor, because the desktop appears in the viewer on your Windows PC.

Why does the address end with :1?

The number after the colon is the VNC display number. It tells the viewer which session on the Pi to open. If you start the server with vncserver :1, you connect to :1.

Why is my VNC password limited to 8 characters?

The classic VNC password system only uses the first 8 characters. For stronger protection, run VNC through an SSH tunnel or a VPN rather than relying on the password alone.

Can I use VNC over WiFi?

Yes. As long as the Pi and the Windows PC are on the same network and you use the Pi’s current IP address, VNC works over WiFi or Ethernet. A wired connection is usually smoother for a full HD desktop.

See also
INTERRUPT - ARM

Revive Your Dead Electronics

Got a drawer full of dead gadgets or a failing car battery? Instead of paying a premium for replacements, use this simple trick to easily recondition them right from home.

See How It Works