ESP8266 Pinout Guide: How should I use the GPIO pins?

This article offers an ESP8266 pinout guide, including pinout diagrams, functions, and instructions on how to use them.

With 17 GPIO pins, the ESP8266 12-E chip comes standard. Some GPIOs are not exposed for usage on all ESP8266 development boards, while others have extremely specific functions. 

By using the most suitable pins for your projects, you'll learn how to properly use the ESP8266 GPIOs and save yourself hours of aggravation.

Note: Not all GPIOs are available on all development boards; however, each GPIO works the same way regardless of the development board you're using.

ESP8266 12-E Chip Pinout

The following figure illustrates the pinout for the ESP8266 12-E chip. If you're using an ESP8266 bare chip in your projects, use this diagram.

ESP8266 12-E chip pinout diagram gpios pins

The following figure illustrates the 12-E chip pinout for the ESP8266. If you're using an ESP8266 bare chip in your projects, this diagram is for you.

The ESP-01, ESP8266-12E NodeMCU Kit, and Wemos D1 Mini are the most widely used ESP8266 boards.

ESP8266-01 Pinout

The following GPIO diagram may be used as a guide if you are using an ESP8266-01 board.

ESP-01 ESP8266 pinout diagram gpios pins

ESP8266 12-E NodeMCU Kit

The pinout diagram for the ESP8266 12-E NodeMCU kit is shown below.

ESP8266 12-E NodeMCU Kit pinout diagram gpios pins

Wemos D1 Mini Pinout

The following figure shows the pinout for the WeMos D1 Mini.

WeMos D1 Mini Pinout diagram gpios pins

Download PDF with ESP8266 Pinout Diagrams

So that you always have the ESP8266 diagrams next to you, we've put up a handy PDF that you can download and print:

ESP8266 Peripherals

The ESP8266 peripherals include:

  • 17 GPIOs
  • SPI
  • I2C (implemented on software)
  • I2S interfaces with DMA
  • UART
  • 10-bit ADC

Best Pins to Use – ESP8266

The GPIO number does not match the label on the board's silkscreen, which is an important point to notice about the ESP8266. D0, for example, corresponds to GPIO16, and D1 to GPIO5. 

The following table shows the correlation between the silkscreen labels and the GPIO number, as well as which pins are suitable to use in your projects and which ones you need to be careful with. 

The pins highlighted in green may be used. You need to pay attention since the ones highlighted in yellow may exhibit unexpected behaviors, particularly during boot. It is not recommended to use the pins highlighted in red as inputs or outputs.

D0GPIO16no interruptno PWM or I2C supportHIGH at boot
used to wake up from deep sleep
D1GPIO5OKOKoften used as SCL (I2C)
D2GPIO4OKOKoften used as SDA (I2C)
D3GPIO0pulled upOKconnected to FLASH button, boot fails if pulled LOW
D4GPIO2pulled upOKHIGH at boot
connected to on-board LED, boot fails if pulled LOW
D8GPIO15pulled to GNDOKSPI (CS)
Boot fails if pulled HIGH
debug output at boot, boot fails if pulled LOW
A0ADC0Analog InputX

For a more thorough and detailed analysis of the ESP8266 GPIOs and their functions, keep reading.

GPIOs connected to the Flash Chip

On ESP8266 boards, GPIOs 6 to 11 are often connected to the flash chip. Therefore, it is not recommended that you use these pins.

Pins used during Boot

If some pins are pulled HIGH or LOW, the ESP8266 may be prevented from booting. The following list shows the status of the pins on BOOT in the state they are in:

  • GPIO16: pin is high at BOOT
  • GPIO0: boot failure if pulled LOW
  • GPIO2: pin is high on BOOT, boot failure if pulled LOW
  • GPIO15: boot failure if pulled HIGH
  • GPIO3: pin is high at BOOT
  • GPIO1: pin is high at BOOT, boot failure if pulled LOW
  • GPIO10: pin is high at BOOT
  • GPIO9: pin is high at BOOT

Pins HIGH at Boot

When the ESP8266 boots, a 3.3-volt signal is output on a few pins. Relays or other peripherals connected to those GPIOs may make this problematic. The HIGH signal is output by the following GPIOs at boot:

  • GPIO16
  • GPIO3
  • GPIO1
  • GPIO10
  • GPIO9

Furthermore, except GPIO5 and GPIO4, the other GPIOs may output a low-voltage signal upon startup, which might be problematic if they are connected to transistors or relays. You may read this article to learn about the state and behavior of each GPIO during startup.

GPIO4 and GPIO5 are the safest GPIOs to use if you want to operate relays.

Analog Input

The ESP8266 only has one GPIO that supports analog reading. On the silkscreen, the GPIO is often marked as A0 and is called ADC0.

When using the ESP8266 bare chip, the maximum input voltage of the ADC0 pin is 0 to 1 V. Because these boards include an in-built voltage divider, the voltage input range is 0 to 3.3 volts when using a development board like the ESP8266 12-E NodeMCU kit.

On-board LED

The majority of ESP8266 development boards have an LED. GPIO2 is generally connected to this LED.

ESP8266 NodeMCU On-board LED

With inverted logic, the LED works. To turn it off, send a HIGH signal, and to turn it on, send a LOW signal.


The ESP8266 is reset when the RST pin is pulled LOW. It is the same as pressing the on-board RESET button when you do this.

ESP8266 NodeMCU On-board Reset button


GPIO0, when pulled LOW, sets the ESP8266 into bootloader mode. This is the same as pressing the FLASH/BOOT button on the board.

ESP8266 NodeMCU GPIO 0 Flash boot button


The ESP8266 may be awakened from deep sleep via GPIO16. GPIO16 should be connected to the RST pin to wake up the ESP8266 from deep sleep.


Although the ESP8266 lacks hardware I2C pins, they may be implemented through software. As a result, you may use any GPIO as an I2C interface. The following GPIOs are often used as I2C pins:

  • GPIO5: SCL
  • GPIO4: SDA


The pins used as SPI in the ESP8266 are:

  • GPIO12: MISO
  • GPIO13: MOSI
  • GPIO14: SCLK
  • GPIO15: CS

PWM Pins

All I/O pins (GPIO 0 to GPIO 15) on the ESP8266 support software PWM. PWM signals on the ESP8266 have a resolution of 10 bits.

Interrupt Pins

The ESP8266 supports interrupts in any GPIO, except GPIO16.


We hope you found our ESP8266 pinout guide helpful. You might leave a comment below if you have any tips on how to use the ESP8266 GPIOs properly.

We hope you find this tutorial useful. Thanks for reading.

Oh hi there It’s nice to meet you.

Sign up to receive awesome content in your inbox, every month.

We don’t spam! Read our privacy policy for more info.

One comment

  1. PWM Pins
    All I/O pins (GPIO 0 to GPIO 15) on the ESP8266 support software PWM. PWM signals on the ESP8266 have a resolution of 10 bits.

    When consulting the datasheet of the nodemcu esp8266 it indicates that only 4 pins are used for PWM:

    GPIO 4

Leave a Reply

Your email address will not be published. Required fields are marked *

ESP8266 Home Automation Projects

Leverage the power of this tiny WiFi chip to build exciting smart home projects