1. Open Arduino IDE.
2. Then, Go to File > Preferences. In the “Additional Boards Manager URLs” field, type (or copy & paste) https://arduino.esp8266.com/stable/package_esp8266com_index.json.
Don’t forget to click OK!
3. Then go to Tools > Board > Board Manager. Type “esp8266” in the search field. The entry “esp8266 by ESP8266 Community” should appear. Click that entry and look for the install button on the lower right.
4. After the installation is completed, click close and your esp8266 board is downloaded and now will be visible in the board area.
5.To run the esp8266 with Arduino IDE,first go to tools,then select the Board and then ESP8266 board and then NodeMCU 1.0 (ESP-12E Module) as shown below:
Or, go to tools then to board and you will see the NodeMCU 1.0 option over there only.(depending upon the version of Arduino IDE)