The Raspberry Pi comes with an on-board 802.11n Wireless LAN adapter, which means that it’s no longer necessary to purchase a separate WiFi dongle. It’s also quite a bit easier to set up. In this tutorial, I’ll show you how to set up WiFi from the command line or from the Raspbian desktop.

You will need access to the Pi’s command prompt or desktop. If you have a monitor and keyboard, that’s as simple as plugging everything in. If you don’t have a keyboard and monitor and are setting up the Pi headless, check out this guide to see how to access the command prompt from another computer.

BONUS: I made a quick start guide for this tutorial that you can download and go back to later if you can’t set this up right now. It covers all of the steps and commands you need to get started.

Configure WiFi from the Command Line

Log in to the Pi with PuTTY or another SSH client.

You probably already know the name of the WiFi network you want to connect to, but if not, enter this at the command prompt:

sudo iwlist wlan0 scan

This will generate a list of all wireless networks available in your area. The name of the network is given on the line that says “ESSID”:

In my case the WiFi network is named “Unit2B61”.

Now we need to add the WiFi name and password to the wpa_supplicant.conf file. Enter this at the command prompt:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

If the file already has the lines below, just edit them. If not, add them to the bottom of the file:

network={ ssid="SSID" psk="WIFI PASSWORD" }

Change “SSID” to the name of your WiFi network, then enter your WiFi password where it says “WIFI PASSWORD”:

Press Ctrl-X, then Y to save and exit.

Now enter this to start the WiFi adapter:

sudo ifdown wlan0

sudo ifup wlan0

If that doesn’t start it, you may need to restart the Pi with sudo reboot or sudo poweroff .

If you’re setting this up via SSH and an ethernet connection to your router, the local IP address will be different for the WiFi network. You’ll need to scan the network with Advanced IP Scanner or another way to find the new local IP of the Pi when it’s connected to WiFi. Then you can use this new IP to connect via PuTTY.

Configure WiFi from the Desktop

If you have a monitor and keyboard and already have access to the Raspbian desktop, setting up WiFi is even easier.

Just click the button with the up and down arrows in the upper right hand corner of the desktop:

Clicking “Turn On WiFi” will bring up a list of available networks, which you can click on to connect to:

You’ll then be asked for the “Pre Shared Key”, which is just the WiFi network password:

Next Steps

If you’re setting up the Pi headless via SSH, and you want to access the Raspbian desktop, you’ll need to set up a remote desktop connection. Follow this tutorial to see how to do that:

How to Access the Raspberry Pi GUI with a Remote Desktop Connection

That’s about it! Let us know in the comments if you have any questions about setting this up. And be sure to subscribe to get an email whenever we publish new tutorials like this one!