DEV Community

Hedy
Hedy

Posted on

How to setup wifi on Raspberry Pi 4?

Here are the three most common (and reliable) ways to set up Wi-Fi on a Raspberry Pi 4, depending on whether you have a screen/keyboard and whether you’re flashing a fresh SD card.

Option 1: Easiest (fresh install) — set Wi-Fi in Raspberry Pi Imager

When you flash Raspberry Pi OS, Raspberry Pi Imager can preconfigure Wi-Fi credentials so the Pi connects on first boot.

Steps

  1. Open Raspberry Pi Imager → choose OS + Storage.
  2. Go to Customise / Settings (gear icon).
  3. Set Wi-Fi SSID + password, country/timezone, and (optionally) enable SSH.
  4. Write the card, boot the Pi.

This is the best method for headless setups.

Option 2: You have Desktop GUI (monitor/keyboard) — click the network icon

Raspberry Pi OS provides a GUI Wi-Fi picker via the network icon on the right side of the top bar.

Steps

  1. Click the network/Wi-Fi icon (top-right).
  2. Select your SSID.
  3. Enter the password → OK, wait a few seconds.

Important (Pi 4 dual-band): set WLAN country
On dual-band models (like Pi 4), Wi-Fi may stay disabled until you set the wireless LAN country. Do it in Preferences → Control Centre → Localisation.

Option 3: Raspberry Pi OS Lite / Headless — use raspi-config + nmcli (Bookworm+)

On Raspberry Pi OS Bookworm and later, NetworkManager is the default networking tool.

1) Set Wi-Fi country (one-time)

sudo raspi-config
Enter fullscreen mode Exit fullscreen mode

Go to Localisation Options → WLAN Country and pick your country.
Raspberry Pi

2) Scan and connect with nmcli

Check Wi-Fi radio:

nmcli radio wifi
Enter fullscreen mode Exit fullscreen mode

List networks:

nmcli dev wifi list
Enter fullscreen mode Exit fullscreen mode

Connect (prompts for password):

sudo nmcli --ask dev wifi connect "<your_ssid>"
Enter fullscreen mode Exit fullscreen mode

These commands are the official recommended flow for CLI Wi-Fi setup on Pi OS.

Note: The old trick of dropping wpa_supplicant.conf onto the boot partition doesn’t work on Bookworm+.

Top comments (0)