ESP32 WiFi Guide: Connect to Networks, Create an Access Point, and Fix Common Issues
Nov 3th, 2026

ESP32 WiFi is one of the most useful features of the ESP32. It allows this small microcontroller to communicate with phones, computers, routers, and other devices without additional networking hardware.
Whether you're building a wireless sensor, a home automation controller, or a device with its own configuration page, understanding ESP32 Wi-Fi modes is a good starting point.
The ESP32 supports three main WiFi modes: Station (STA), Access Point (AP), and AP+STA.
| Mode | How it works | Best use |
|---|---|---|
| Station (STA) | Connects to an existing router | IoT sensors, cloud applications |
| Access Point (AP) | Creates its own Wi-Fi network | Local control, device setup |
| AP+STA | Runs both interfaces | Configuration and network access |
This ESP32 WiFi tutorial covers all three modes using Arduino IDE, with practical examples and troubleshooting advice.
How ESP32 Wi-Fi Works
The original ESP32 WiFi hardware operates at 2.4 GHz and supports IEEE 802.11 b/g/n.Other chips in the ESP32 family have different wireless capabilities. For example, the ESP32-C5 supports both 2.4 GHz and 5 GHz Wi-Fi.
Every Wi-Fi interface has a MAC address, which identifies it on a local network.An ESP32 WiFi IP address allows the device to exchange data with other devices using TCP/IP.When an ESP32 joins a router, it normally receives an IP address through DHCP.
Hardware and software
The examples in this ESP32 WiFi tutorial target the following hardware and software configuration:
•Board: Espressif ESP32-DevKitC V4
•Chip: ESP32-WROOM-32E
•Arduino IDE: 2.3.6
•Arduino-ESP32 core: 3.3.7
•Library: WiFi.h, included with the ESP32 core
The hardware and software versions used in this ESP32 WiFi tutorial are the intended reference configuration, not a claim of physical testing.The sketches have not been uploaded to a physical board or independently verified on that exact setup.
ESP32 Station Mode (STA): Connecting to Wi-Fi
ESP32 Station mode (STA) allows the board to connect to an existing wireless network, just like a laptop or smartphone.

To establish an ESP32 WiFi connection, you need the network name (SSID) and password. Once connected, the router usually assigns the board an IP address automatically.
Arduino example: Connect with automatic recovery
The sketch repeatedly checks the ESP32 WiFi connection status in loop(). While disconnected, it prints the current status and restarts the connection attempt when at least ten seconds have passed since the previous attempt began. Each restart calls WiFi.disconnect() followed by WiFi.begin().
This avoids an indefinite waiting loop, but it does not diagnose every case of an ESP32 WiFi not connecting to the router.The messages suggest what to check; they do not confirm the cause. Retries continue until the ESP32 connects, with no maximum attempt count.
Expected Serial Monitor output

The ESP32 WiFi IP address depends on your router's network configuration. If the connection fails, check the credentials, signal strength, and router frequency.
ESP32 Access Point Mode (AP): Creating a Wi-Fi Network
In ESP32 Access Point (AP) mode, the board creates its own wireless hotspot. Phones and computers can connect directly without a separate router.

ESP32 Access Point mode is useful for local dashboards, device configuration, and projects operating without internet access.
Arduino example: AP with a local webpage
To connect to the ESP32 Access Point, select the ESP32-Setup network on your phone and enter the password esp32demo123. Then open http://192.168.4.1 in a browser.

ESP32 Wi-Fi
Access Point is working!
Illustrative browser preview of the HTML returned by the sketch, not a captured hardware screenshot.

A phone connected to an ESP32 Access Point may display "Connected without internet." This is normal because the hotspot provides a local network, not internet connectivity.
ESP32 AP+STA Mode:Using Both Interfaces
ESP32 AP+STA mode allows the board to connect to a router while maintaining its own Wi-Fi hotspot.

In ESP32 AP+STA mode, the two connections remain separate. The ESP32 does not automatically share the router's internet connection with the phone.
Internet forwarding requires additional routing and NAT configuration.
Arduino example: AP+STA
Example output:
AP IP: 192.168.4.1
STA IP: 192.168.1.105
Among the available ESP32 WiFi modes, AP+STA is useful for configuration interfaces and connected IoT products.Initial provisioning can also start in AP mode and switch to STA once credentials are saved.
Uploading the Examples
To upload ESP32 WiFi examples using Arduino IDE, connect the board to your computer with a data-capable USB cable.In Arduino IDE, install esp32 by Espressif Systems through Boards Manager. For detailed setup instructions, follow our ESP32 Arduino IDE setup guide.
Select the appropriate ESP32 board profile, choose the correct COM/serial port, paste one example into a sketch, and click Upload.
Open Serial Monitor at 115200 baud, then press Reset if necessary.Check the reported IP address and ESP32 WiFi connection status.
Scanning Nearby Wi-Fi Networks
The ESP32 can discover nearby networks and report their signal strengths. For more details on network scanning functions, refer to Espressif's official ESP32 WiFi scanning documentation.
Example output:
HomeNetwork | RSSI: -45
OfficeWiFi | RSSI: -67
GuestWiFi | RSSI: -82
Static IP vs DHCP
An ESP32 WiFi IP address can be assigned automatically through DHCP or configured manually as a static IP. A static IP can make a local ESP32 web server easier to find.
DNS servers translate domain names, such as example.com, into IP addresses. When configuring a static ESP32 WiFi IP address, specify DNS servers if your application needs to access services by domain name. Accessing a device directly by its IP address does not require DNS resolution.
To configure a static ESP32 WiFi IP address in the earlier “Arduino example: Connect with automatic recovery” sketch, make the following changes.
Step 1: Configure the static IP before connecting
In setup(), insert the following configuration immediately after WiFi.mode(WIFI_STA); and before connectWiFi();. The updated setup() should look like this:
These addresses are examples.Replace the ESP32 WiFi IP address, gateway, and subnet mask with values appropriate for your network.Choose an unused local IP and keep it outside the router’s dynamic DHCP allocation range, or exclude it from that range, to prevent address conflicts.
The DNS addresses above are Google Public DNS servers. You can use your router’s DNS service, if available, or other DNS servers permitted by your network.
A successful WiFi.config() call means the configuration was accepted; it does not confirm that the gateway or DNS servers are reachable.
Step 2: Print the network settings after connecting
In loop(), find:
Replace it with:
Leave the rest of the sketch unchanged.
If an ESP32 WiFi connection obtains the expected IP address but cannot access a service by domain name, check the device's DNS settings and server reachability.Also verify the gateway and upstream internet connection, because DNS is not the only possible cause.
For a fixed address with less device-side configuration, consider a DHCP reservation on the router.The ESP32 continues using DHCP, while the router consistently assigns the same ESP32 WiFi IP address.
Checking Wi-Fi Signal Strength
ESP32 WiFi signal strength is measured using RSSI (Received Signal Strength Indicator) in dBm. Values closer to zero generally indicate stronger reception.
| RSSI | Typical interpretation |
|---|---|
| -30 to -50 dBm | Excellent |
| -51 to -65 dBm | Good |
| -66 to -75 dBm | Fair |
| Below -75 dBm | Weak |
To check ESP32 WiFi signal strength, use WiFi.RSSI() while the board is connected in STA mode.
Improving ESP32 Wi-Fi Range
To improve ESP32 WiFi signal strength, keep the antenna away from metal objects, dense wiring, and large components. Plastic enclosures usually work better than metal ones for wireless devices.
Router placement also matters. A centrally located router with fewer walls between devices can improve reception.
Some ESP32 development boards provide connectors for external antennas. Check the board's antenna selection hardware before connecting one.
Wi-Fi Power Consumption
ESP32 WiFi transmission consumes considerably more power than idle processing.Active Wi-Fi provides continuous communication but increases current consumption.
Modem sleep reduces radio activity while allowing the ESP32 to maintain its WiFi connection.Deep sleep powers down the Wi-Fi connection. After waking, the ESP32 must reconnect. For details about sleep states and wireless power management, see Espressif's official ESP32 sleep modes documentation.The best option depends on how frequently the application needs to exchange data. For battery-powered projects, explore our ESP32 low power sensor node guide to learn how sleep modes can reduce energy consumption.
Common ESP32 Wi-Fi Problems
| Symptom | Possible cause | Solution |
|---|---|---|
| Cannot connect to the router | Incorrect SSID or password | Check capitalization and unintended leading or trailing spaces in both values. Use the Wi-Fi password for that network, rather than the router’s administration password. Print the connection status to help narrow down the issue. |
| Target network is not visible | Unsupported frequency, weak signal, or incorrect SSID | Run the network-scanning example and check whether the target SSID appears. For the original ESP32 used in this guide, enable a 2.4 GHz network on the router. Move the board closer and confirm the SSID matches exactly. |
| ESP32 repeatedly disconnects or restarts | Unstable power, poor USB cable, or weak signal | Try a known-good USB cable and a stable power source suitable for the board. Check Serial Monitor for brownout messages or repeated boot logs. If the board stays running but loses Wi-Fi, check RSSI and router availability. |
| Weak RSSI | Distance, obstacles, interference, or antenna placement | Move the board closer to the router and compare RSSI readings. Keep the antenna away from metal, dense wiring, and large components. Test outside the enclosure to see whether it is reducing reception. |
| Connects to Wi-Fi but does not obtain an IP address | DHCP is disabled or its address pool is exhausted | Confirm that the router’s DHCP server is enabled and has available addresses. Check the router’s client list and print WiFi.localIP() after the ESP32 reports a successful connection. If you configured a static IP, verify its subnet and check for address conflicts instead. |
| Has an IP address but cannot access a service by domain name | Missing or unreachable DNS server, incorrect gateway, or no upstream internet access | Print WiFi.dnsIP() and WiFi.gatewayIP(). Verify that the settings match your network. Confirm that the DNS server is reachable and that the router has internet access if the service requires it. |
| Phone reports “Connected without internet” on the ESP32 hotspot | The hotspot provides a local network without internet forwarding | This is expected for the standalone AP example. Choose to stay connected if prompted, then open the ESP32’s local address using http://. AP+STA mode also does not automatically provide internet forwarding. |
| Phone connects to the ESP32 hotspot, but the webpage does not open | Wrong address, automatic network switching, or no web server running | Use the AP with a local webpage sketch. Check the AP address printed in Serial Monitor and enter it with http://, for example http://192.168.4.1. Confirm the phone is still connected to ESP32-Setup. If it switches networks, choose to stay connected; temporarily disable mobile data if necessary. Also check that the sketch calls server.begin() in setup() and server.handleClient() in loop(). |
Which Wi-Fi Mode Should You Use?
For most connected IoT projects, Station mode is the simplest choice. It uses an existing router and provides access to other network devices.
Choose ESP32 Access Point mode when the board needs to operate independently or provide a local configuration page.Use AP+STA when both interfaces must remain available simultaneously.
Once these fundamentals are working, more advanced projects can introduce provisioning portals, MQTT communication, and network routing. You can also explore our ESP32 OTA update guide to learn how to upload firmware wirelessly over Wi-Fi.
Conclusion
This ESP32 WiFi guide covered the three main ESP32 WiFi modes: connecting to a router in Station mode, creating a local network in Access Point mode, and running both interfaces with AP+STA. Choose STA for projects that use an existing network, AP for direct local access, and AP+STA when both connections are needed. Remember that AP+STA does not automatically share internet access. Network scanning, readable connection messages, and checks of IP settings, signal strength, and power stability can help you troubleshoot problems. With these fundamentals in place, you can move on to web dashboards, wireless sensors, and other connected projects.
FAQ
Does ESP32 support 5 GHz Wi-Fi?
It depends on the chip. The original ESP32 used in this guide supports 2.4 GHz Wi-Fi, while the ESP32-C5 supports both 2.4 GHz and 5 GHz. Check your specific chip’s specifications before choosing a network.For example, the ESP32-C5 supports both 2.4 GHz and 5 GHz Wi-Fi. For details about Station and Access Point operation, refer to the official ESP32 Wi-Fi API documentation.
Can ESP32 work without a Wi-Fi router?
Yes. In ESP32 Access Point mode, the board creates its own Wi-Fi network that a phone or computer can join.With a web server running on the ESP32, connected devices can open a local page without a separate router or internet connection.
What is the difference between STA, AP, and AP+STA?
The three main ESP32 WiFi modes serve different purposes. STA connects the ESP32 to an existing Wi-Fi network. AP creates a network for other devices to join. AP+STA enables both interfaces simultaneously, allowing the ESP32 to connect to a router while maintaining its own hotspot.
Does AP+STA mode give connected devices internet access?
Not automatically. AP+STA enables two network interfaces, but forwarding internet traffic between them requires additional routing and NAT configuration. The AP+STA example in this guide does not provide internet sharing.
Why does my phone say the ESP32 hotspot has no internet?
The standalone ESP32 Access Point provides a local Wi-Fi network without an internet connection.Choose to stay connected if prompted, then open the AP address printed in Serial Monitor using http://. This warning does not, by itself, mean the hotspot has failed.
