esp8266 get ip address

This tutorial explains how to get ip address assigned to ESP8266? In DHCP configuration IP is assigned by WiFi Router. In most WiFi Router you can get IP address from WiFi router from its connected device status window. But WiFi router shows ip address only when there is data sent on network. If ESP is connected but did not sent any packet on network then WiFi router may not show ip address of your ESP. If it is connected then you will have to identify your ESP name. i.e. set using


To get the IP address of ESP in program useĀ  this function WiFi.localIP()

Get ESP8266 IP Address on Serial monitor

Most people prefer to get ESP8266 IP address on serial monitor. But in many cases it is difficult to have serial connection always connected and having display for just to know ip address. Better way is, use of mDNS.

 * Get IP Address of ESP8266 in Arduino IDE
#include <ESP8266WiFi.h>

  const char* wifiName = "";
  const char* wifiPass = "your_password";
// the setup function runs once when you press reset or power the board
void setup() {
  // We start by connecting to a WiFi network

  Serial.print("Connecting to ");

  WiFi.begin(wifiName, wifiPass);

  while (WiFi.status() != WL_CONNECTED) {

  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());   //You can get IP address assigned to ESP

// the loop function runs over and over again forever
void loop() {

Upload this program it will show you IP address of your ESP on serial monitor

get ip address of ESP8266

Similar way you can get MAC Address of ESP8266 also Read here

Leave a Reply