setup wi-fi on raspberry pi

How to Configure Wi-Fi on Raspberry Pi? (6 Easy Ways)

All recent Raspberry Pi models include a wireless connection, but the configuration is not always easy, especially if you don’t have a graphic interface or need to set up an advanced Wi-Fi configuration. Don’t worry, I’ll explain everything with simple steps in this tutorial.

The easiest way to set up Wi-Fi on a Raspberry Pi is to do it directly in the advanced options of Raspberry Pi Imager when installing the system. If the system is already installed, the GUI and raspi-config offer intuitive interfaces too.

I’ll show you everything in this post. There are several solutions available depending on your system version and access to it. I have put them in order of most recommended / simple to most advanced, so feel free to jump directly to the part you are looking for.

If you’re looking to quickly progress on Raspberry Pi, you can check out my e-book here. It’s a 30-day challenge where you learn one new thing every day until you become a Raspberry Pi expert. The first third of the book teaches you the basics, but the following chapters include projects you can try on your own.

Want the best experience? Become a premium member for ad-free browsing, access exclusive content, and ask questions in our private forums. Your membership helps support the site!

Recommended: 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’s advanced options.
    Select the operating system you want to use (let’s say Raspberry Pi OS) and your storage device (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, and also configure your Wi-Fi connection. Fill in 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.

If you are using this tool for the first time, please take a look at my complete guide about Raspberry Pi Imager here. I explain everything in more detail and give you many advanced tips.

Configure Wi-Fi on Raspberry Pi OS Desktop

Now, if the system is already installed, or you didn’t use the Raspberry Pi Imager options, here are two ways to do it on Raspberry Pi OS with a desktop interface.

Via the welcome wizard

If it’s your first boot and you haven’t configured anything via Raspberry Pi Imager or other methods, you should get a “Welcome to Raspberry Pi” wizard asking you to configure a few things on your system.

It’s the easiest way to configure the Wi-Fi on a brand new Raspberry Pi OS with Desktop, so don’t miss this menu. You’ll be asked to configure the country, keyboard layout and create a new user.
Then you’ll get a window like this to select a wireless network:

Download the Pi Glossary!
If you are lost in all these new words and abbreviations, request my free Raspberry Pi glossary here (PDF format)!
Download now

Select your Wi-Fi network SSID in the list, click “Next” and type the password in the following screen:

A few seconds later, the Raspberry Pi will be connected to your Wi-Fi.

Via the menu in the top bar

If you missed the welcome wizard or skipped the Wi-Fi configuration here, you can do it or change it at any time from the taskbar panel:

At the top of your screen, 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, or two blue arrows if you’re connected via Ethernet).
  • Click on it and a list of all available wireless networks appears.
  • Select your network in the list and type your password.

That’s it, you should be connected instantly. It’s 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 out how to configure your network.
Let’s see two methods to do this (the first one is recommended).

Using the raspi-config tool

The Raspberry Pi Foundation was thinking of you. Even if you are on a black-and-white screen, there is a tool to help you to configure everything on the system including your wireless network.

This tool is named “raspi-config” and it’s 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 configure Wi-Fi 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.

Are you a bit lost in the Linux command line? Check this article first for the most important commands to remember and a free downloadable cheat sheet so you can have the commands at your fingertips.

Manual configuration

If for any reason, raspi-config is not an option for you, there are other tools you can try.

Raspberry Pi OS Bookworm

Since Raspberry Pi OS Bookworm, wpa_supplicant is no longer used. The good news is that there is a tool to do the manual configuration, so it’s easier overall:

Download the Pi Glossary!
If you are lost in all these new words and abbreviations, request my free Raspberry Pi glossary here (PDF format)!
Download now
  • Run this command to start the tool:
    sudo nmtui
  • A window like this one shows up:
  • Simply use the wizard to “Activate a connection” and access your Wi-Fi network:

Once a connection added (like the Wi-Fi network in my example), you can choose “Edit a connection” to change the security, password or set a static IP address.

Raspberry Pi OS Bullseye and previous versions

Anyway, 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

By default, the file is almost empty:

You’ll need to add a few lines with the network configuration and the country (mandatory).
In the end, you should have something like this:

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
}

Please don’t hesitate to copy and paste these lines in place of the existing ones. For a standard WPA-PSK configuration, you just need to replace the SSID and password.

If the new configuration doesn’t work after a few minutes, you may need to restart the Raspberry Pi:
sudo reboot

You can find many examples here to adapt the configuration to your network (if you use WEP, EAP, or any other security options).

And if you also need to set up a static IP address on your Raspberry Pi, you can click on the link to my other tutorial where I explain all the steps (scroll to the end of the article for the method with command lines).

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

The hard way: Headless + Manual configuration

I call this “headless” because it’s the method to use when you don’t have a screen on your Raspberry Pi. But you can absolutely use it in any case. Besides, that’s what I was doing most of the time (before Imager advanced options).

For a one-time installation, the easiest option for headless Wi-Fi configuration is now to use Raspberry Pi Imager, but if for any reason you want to do it manually, here is the full procedure with wpa supplicant.

This solution doesn’t work anymore with Raspberry Pi OS Bookworm, use Raspberry Pi Imager.

The idea is to add a new file on the SD card (or USB drive) that will include the Wi-Fi configuration. This file is named “wpa_supplicant.conf” and will include the same lines as in the manual configuration I explained earlier (for RPI OS Lite).

Here are the steps to create this file:

  • 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 the variables with your SSID and password and change the country value if needed.
    This is the configuration for a standard WPA-PSK wireless network, check the documentation for more advanced options.
  • Save the file to a location you can find easily the next time you create a new SD card.

Insert your SD card into your computer (you may need to eject it and re-insert it if you just flashed it). Then copy the wpa_supplicant.conf file to the boot partition.

Note: If you don’t have an SD card reader on your computer, you can get a cheap USB to SD card adapter on Amazon (this one, for example).

It works with any Raspberry Pi OS version (Desktop or Lite), so it’s perfect for any use and you’ll save time if (like me) you install new systems all the time.

Bonus tip: Enable SSH automatically

Another thing you may want to do if you really use your Raspberry Pi without a screen is to enable the SSH service automatically. On Raspberry Pi OS, SSH is disabled by default.

To enable it automatically there is another file to create.
Just create an empty file named “ssh” into the same partition (boot).
That’s enough to tell Raspberry Pi OS to start the SSH service automatically on boot.

It’s something I use all the time, and I explained it in more detail in this tutorial on how to install a Raspberry Pi without a screen and keyboard.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Reminder: Remember that all the members of my community get access to this website without ads, exclusive courses and much more. You can become part of this community for as little as $5 per month & get all the benefits immediately.

Going further

That’s it, you now know different ways to set up the Wi-Fi on your Raspberry Pi, whatever the system version you use or your network complexity.

As a general rule, I would recommend using the advanced options in Raspberry Pi imager when possible, but you have discovered many other solutions to suit each situation. You learned a lot today!

Now that you are connected to the Internet, you can start having fun with many different projects on your Raspberry Pi. Here are a few articles I wrote that you can check out for more ideas :

Whenever you’re ready, here are other ways I can help you:

The RaspberryTips Community: If you want to hang out with me and other Raspberry Pi fans, you can join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.

Master your Raspberry Pi in 30 days: If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.

The Raspberry Pi Bootcamp: Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.

Master Python on Raspberry Pi: Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts.

You can also find all my recommendations for tools and hardware on this page.

Similar Posts

3 Comments

  1. I run Motioneye on my PI, I have recently changed my home router, now the PI cannot log in because the router and password info is incorrect. I am unable to get to the command screen as Motioneye starts up on boot? how do I now change the router info please?

    1. Hi Ken,

      I suppose you want to say “motionEyeOS”
      I don’t know this OS, but in the wiki, they say that the configuration is in the wpa_supplicant.conf file, maybe /data/etc/wpa_supplicant.conf

      If you find it, you can edit the file with the default editor and update your settings

Comments are closed.