It’s probably the most common question when installing your first Raspberry Pi, so I choose to write a guide about it to help you find the good solution in your specific case.
All recent Raspberry Pi models (Pi 3, 4/400 and Zero W) include a wireless connection, but the configuration is not always easy, especially with a complex or secured network, or on Raspberry Pi OS Lite.
I will answer all your questions in this post.
Here are the steps to configure the Wi-Fi network on a Raspberry Pi:
- Open a terminal
- Type the following command to open the configuration tool:
sudo raspi-config - Go to Network Options > Wi-Fi
- Follow the wizard to choose a SSID and enter the password.
I’ll show you everything in this post. There are several solutions available, depending on your system version and access to it.
Raspberry Pi Wi-Fi Headless Configuration
I call this part “headless” because it’s the way you can use if you don’t have a screen on your Raspberry Pi.
But you can absolutely use it in any case. Besides, that’s what I do most of the time.
Use Raspberry Pi Imager
The easiest way currently to set up your Wi-Fi connection before the first boot is to use Raspberry Pi Imager. This tool includes advanced settings where you can set up a few things, including the wireless network you want to use.
- Download and install Raspberry Pi Imager on your computer.
If you don’t have it yet, you can get it for free from the official website. It’s available for Windows, Linux and even for Raspberry Pi OS. - Use Raspberry Pi Imager advanced options.
Select the operating system you want to use (let’s say Raspberry Pi OS), and your storage (SD card or USB).
Then, click on the settings icon in the bottom right to open the advanced options:
In this form, you can enable SSH, set the username and password but also configure your Wi-Fi connection.
Fill the SSID, password and country, then click on “Save”. - Click on the “Write” button to start the installation. Your settings will be included on the media.
Your Raspberry Pi will be connected automatically to your network on the first boot. Check the next part if you don’t use Raspberry Pi Imager, or want to do the same thing manually.
Manual configuration
Method
This solution applies if you just flashed your SD card, and want to enable Wi-Fi on your fresh system on the first boot (but it also works for an old SD card you used with Ethernet or an old wireless network).
You have a file to create and copy on the SD card, so on the next boot, Raspberry Pi OS will read the file and apply the configuration directly.
You don’t have anything else to do.
Good idea no?
wpa_supplicant.conf
Let’s see how to do this:
- Open your favorite text editor on your computer.
The basic editor from your operating system will be fine (Notepad for example). - Copy and paste these lines into it:
country=US ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="YOURSSID" scan_ssid=1 psk="YOURPASSWORD" key_mgmt=WPA-PSK }
- Replace variables with your SSID and password, and change the country value if needed.
- Save the file on a location you can find easily the next time you create a new SD card.
Insert your SD card into your computer (for a fresh new SD card created with Etcher, you have to eject and insert it again).
Then copy the wpa_supplicant.conf file to the boot partition.
It works with any Raspberry Pi OS version (Desktop or Lite).
So, it’s perfect for any use.
Enable SSH automatically
Another thing you may want to add, if you really use your Raspberry Pi without screen, is to enable the SSH service automatically.
On RPI OS, it’s not the case by default. Even if your Pi connects to your wireless network, SSH will not be enabled.
To do this, there is another file to create.
Just create an empty file, named “ssh” into the same partition (boot).
It’s enough to tell Raspberry Pi OS to start the SSH service automatically on boot.
Configure Wi-Fi on Raspberry Pi OS Desktop
Let’s see now how to configure your Wi-Fi once you’re on Raspberry Pi OS with Desktop.
Welcome wizard
If it’s your first boot, you should get a “Welcome to Raspberry Pi” message, asking you to set up your system.
It’s the easiest way to do on Raspberry Pi OS with Desktop, don’t miss this menu.
After setting the country and password, you’ll get a window like this:

Select your Wi-Fi network SSID in the list, and type the password.
A few seconds later, you’ll be connected to your network.
Task bar
If you missed the welcome wizard, or skipped the Wi-Fi configuration here, you can do it or change it at anytime in the taskbar panel
- On the top you have the main panel, with the menu, shortcuts and the clock.
- Near the clock, there is a network symbol (with two red crosses if you are disconnected).
- Click on it, a list of all available wireless networks appears.
- Select your network in the list, and type your password.
That’s it, not very complicated either 🙂
Set up your Wi-Fi on Raspberry Pi OS Lite
If you’re on Raspberry Pi OS Lite, you may need more help to find how to configure your network.
Let’s see how to do this.
Raspi-config tool
The Raspberry Pi Foundation thought of you.
Even if you are on a black and white screen, there is a tool to help you to configure your wireless network easily.
This tool is raspi-config, available by default on Raspberry Pi OS Lite:
- Start raspi-config with:
sudo raspi-config
- Go into System Options > Wireless LAN.
- Type your SSID and your password.
- Exit the tool.
After a few seconds, your Pi is now connected to the wireless network you chose.
That’s an easy way to do on Raspberry Pi OS Lite.
Note: On older versions of Raspberry Pi OS, the menu may be slightly different. If you can’t find the same thing, the wireless configuration is probably under Network options > Wi-Fi.
Manual configuration
The last option is not easy, but only useful for specific network I think
In fact, I’m not sure when manual configuration is the only option.
Maybe on a big network with secure authentication, a critical device or static network?
Anyway, here is how to create a manual configuration, even if it’s just for your curiosity 🙂
WPA Supplicant
The wireless configuration on the Raspberry Pi is located in /etc/wpa_supplicant.
You can edit the configuration file with nano:sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
The syntax is the same as we saw in the first part, with the file you can put on your SD card.
You’ll find here the same information, so you can change them directly in this file if needed.
Here is a reminder of a basic configuration syntax with WPA-PSK:
country=US ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="YOURSSID" scan_ssid=1 psk="YOURPASSWORD" key_mgmt=WPA-PSK }
If the new configuration doesn’t apply after a few minutes, you may need to reboot the Raspberry Pi:sudo reboot
Network configuration
Finally, if you need a static IP on your network, the interface configuration can be done in dhcpcd.conf:
- Open the file:
sudo nano /etc/dhcpcd.conf
- Find the “Example static IP configuration” paragraph.
- Uncomment every line you need (probably ip_address, routers and domaine_name_servers), and change the values to adapt to your network.
- Here is a basic example:
interface wlan0
static ip_address=192.168.1.10/24
static routers=192.168.1.1
static domain_name_servers=8.8.8.8 - Save and exit, then reboot the Raspberry Pi:
sudo reboot
I have a complete tutorial on this website on how to find the current IP address of a Raspberry Pi, and set it to a static one. Feel free to check it out for more details.
Conclusion
That’s it, you know everything you need to set up the Wi-Fi on your Raspberry Pi, whatever your network.
I hope this post was helpful.
As a general rule, it’s easy when you know what to do, but maybe I’ve never been in a situation where configuring Wi-Fi on the Raspberry Pi was complicated 🙂