How to Use VNC on Raspberry Pi: Easy Remote Desktop Setup
To use
VNC on Raspberry Pi, first enable VNC Server in the Raspberry Pi configuration settings. Then, connect remotely using a VNC Viewer from another device by entering the Pi's IP address.Syntax
Using VNC on Raspberry Pi involves enabling the VNC server and connecting with a VNC client. The main commands and steps are:
sudo raspi-config: Opens Raspberry Pi configuration to enable VNC.vncserver: Starts the VNC server manually (optional).- Use a VNC viewer app on your computer or phone to connect using
IP_address:port.
bash
sudo raspi-config # Navigate to Interface Options > VNC > Enable # Optional manual start of VNC server vncserver :1 # Connect from client using IP and port, e.g., 192.168.1.10:1
Example
This example shows how to enable VNC on Raspberry Pi and connect from a Windows PC using RealVNC Viewer.
bash
sudo raspi-config # 1. Select 'Interface Options' # 2. Select 'VNC' # 3. Choose 'Yes' to enable # On Windows PC: # Download and open RealVNC Viewer # Enter Raspberry Pi IP address (e.g., 192.168.1.10) # Enter Pi username and password when prompted
Output
VNC Server enabled
Connected to 192.168.1.10
Login successful
Desktop visible
Common Pitfalls
Common mistakes when using VNC on Raspberry Pi include:
- Not enabling VNC in
raspi-config. - Trying to connect without knowing the Pi's correct IP address.
- Firewall or network blocking VNC ports (usually 5900+).
- Using wrong username or password for login.
Always ensure your Raspberry Pi and client device are on the same network or properly routed.
bash
sudo raspi-config
# Wrong: Not enabling VNC
# Right: Enable VNC under Interface Options
# Wrong: Connecting to wrong IP
# Right: Find IP with 'hostname -I' and use itQuick Reference
| Step | Command/Action | Description |
|---|---|---|
| 1 | sudo raspi-config | Open Raspberry Pi configuration menu |
| 2 | Interface Options > VNC > Enable | Turn on VNC server |
| 3 | hostname -I | Find Raspberry Pi IP address |
| 4 | Use VNC Viewer on client | Connect to Pi using IP address |
| 5 | Enter Pi username/password | Authenticate remote session |
Key Takeaways
Enable VNC server on Raspberry Pi via sudo raspi-config under Interface Options.
Use the Pi's IP address with a VNC viewer app to connect remotely.
Ensure both devices are on the same network or properly routed.
Check firewall settings if connection fails.
Use correct username and password for login.