Raspberry Pi OS Lite has no desktop, so Wi-Fi is set up from the terminal or before the first boot. On old versions (the Raspbian of this original article) editing wpa_supplicant.conf was enough, but since Bookworm the network is managed by NetworkManager and that file no longer works. Here are the current ways to connect your Raspberry to Wi-Fi, from the easiest to the most manual.
Before you start
- A model with Wi-Fi: Raspberry Pi 3, 4, 5, 400, 500, Zero W or Zero 2 W. From the Pi 3B+ they also support 5 GHz; the Zero W and Zero 2 W only 2.4 GHz.
- The exact network name (SSID) and password.
- Your country code (in the US,
US). Until the Wi-Fi country is set, the system keeps it disabled for safety, since each country allows different channels.
Option 1: from Raspberry Pi Imager (before first boot)
This is the simplest if you are writing the card. In Raspberry Pi Imager’s customization step, fill in the network name, password and Wi-Fi country. Take the chance to create your user and enable SSH, as explained in enable SSH without monitor or keyboard. On boot, the Raspberry connects by itself.

Use Imager 2.0 or later: Trixie images published since late November 2025 are configured with cloud-init, and older Imager versions cannot customize them.
Option 2: edit network-config on the card (Trixie)
If you already wrote the card with a recent Trixie image, you will find the network-config file in the boot partition. Open it with a text editor on your computer and leave something like this (it is YAML: respect the spaces):

network:
version: 2
wifis:
renderer: NetworkManager
wlan0:
dhcp4: true
regulatory-domain: "US"
access-points:
"YourNetworkName":
password: "your-wifi-password"
optional: true
regulatory-domain is the country code, and optional: true keeps the boot from waiting for Wi-Fi. This example follows the one Raspberry Pi publishes; cloud-init processes it on first boot.
Option 3: with nmcli from the terminal (Bookworm and Trixie)
If you already have access to the Raspberry (Ethernet cable or monitor and keyboard), nmcli is the direct tool.

First, set the country if you did not at install. With sudo raspi-config go to 5 Localisation Options › L4 WLAN Country and choose yours (for example US).
Check the Wi-Fi radio is on and turn it on if needed:
nmcli radio wifi
nmcli radio wifi on
Look for available networks:
nmcli dev wifi list
Connect to yours. With --ask it prompts for the password without saving it in terminal history:
sudo nmcli --ask dev wifi connect "YourNetworkName"
If the network is hidden (does not broadcast its name):
sudo nmcli --ask dev wifi connect "YourNetworkName" hidden yes
NetworkManager saves the connection and reconnects on each boot. If you prefer a menu, sudo nmtui › Activate a connection does the same.
Several networks and priority
If the Raspberry moves between two places, you can save several networks and decide which it prefers. To see priorities:
nmcli --fields AUTOCONNECT-PRIORITY,NAME connection
And to raise one (higher means more preference):
sudo nmcli connection modify "YourNetworkName" connection.autoconnect-priority 10
Old systems: wpa_supplicant.conf (Bullseye and earlier)
On Raspbian and Raspberry Pi OS up to Bullseye, Wi-Fi was configured in /etc/wpa_supplicant/wpa_supplicant.conf by appending a block like this:
country=US
network={
ssid="YourNetworkName"
psk="your-wifi-password"
}
Note the double quotes: with single quotes, as in the previous version of this article, it does not work. On Bookworm and Trixie this method is no longer used.
Check that it works
nmcli dev wifi list
nmcli device status
hostname -I
ping -c 3 raspberrypi.com
In the network list, yours shows an asterisk (*) in the IN-USE column. nmcli device status should show wlan0 as connected, and hostname -I gives the IP to connect over SSH.
Common problems
nmcli dev wifi list shows no networks. Usually the country is not set or the radio is off. Set the country in raspi-config and run nmcli radio wifi on. You can also check for blocking with rfkill list.
Your 5 GHz network does not appear. The Zero W and Zero 2 W only work on 2.4 GHz. On others, check the country is set correctly, since it determines available channels.
Secrets were required, but not provided. The password is wrong. Run the connection again with --ask and type it carefully (it is case sensitive).
It connects but drops after a while. Try disabling Wi-Fi power saving in raspi-config, 6 Advanced Options › A13 WLAN Power Save, and check the power supply is adequate.
Wi-Fi customization was not applied on first boot. Check the indentation of network-config (YAML does not allow tabs) or update Raspberry Pi Imager to 2.0 or later.
Frequently asked questions
Where are networks stored? Connections you create with nmcli live in /etc/NetworkManager/system-connections/.
Can I give Wi-Fi a static IP? Yes, on the wlan0 interface. Step by step in set a static IP on Raspberry Pi OS.
Related
- Set a static IP on Raspberry Pi OS
- Enable SSH on a Raspberry Pi without monitor or keyboard
- Which Raspberry Pi to buy: Pi 5, Pi 4 or Zero 2 W



