One of the great things about ESP32 is that it has a lot more GPIOs than ESP8266. You won’t have to juggle or multiplex your IO pins. There are a few things to watch out for so please read the pinout carefully.
Note:
Please note that the following pinout reference is for the popular ESP32 devkit v1 development board with 30 pins.

Not all pins are broken out in all ESP32 development boards, but each specific pin works the same way regardless of the development board you are using.
ESP32 Peripherals and I/O
Although the ESP32 has total 48 GPIO pins, only 25 of them are broken out to the pin headers on both sides of the development board. These pins can be assigned to all sorts of peripheral duties, including:
15 ADC channels | 15 channels of 12-bit SAR ADC’s. The ADC range can be set, in firmware, to either 0-1V, 0-1.4V, 0-2V, or 0-4V |
2 UART interfaces | 2 UART interfaces. One is used to load code serially. They feature flow control, and support IrDA too! |
25 PWM outputs | 25 channels of PWM pins for dimming LEDs or controlling motors. |
2 DAC channels | 8-bit DACs to produce true analog voltages. |
3 SPI & 1 I2C interfaces | There are 3 SPI and 1 I2C interfaces to hook up all sorts of sensors and peripherals. |
9 Touch Pads | 9 GPIOs feature capacitive touch sensing. |
Thanks to the ESP32’s pin multiplexing feature (Multiple peripherals multiplexed on a single GPIO pin). Meaning a single GPIO pin can act as an ADC input/DAC output/Touch pad.
You can get extensive information about ESP32 from the datasheet.
ESP32 Pinout
The ESP32 development board has a total of 30 pins that connect it to the outside world. For simplicity, pins with similar functionality are grouped together. The pinout is as follows:

Let us analyze the ESP32 pins and their functions one by one in more detail.
ESP32 GPIO Pins
ESP32 development board has 25 GPIO pins which can be assigned to various functions programmatically. Each digital enabled GPIO can be configured to internal pull-up or pull-down, or set to high impedance.

Which ESP32 GPIOs are safe to use?
Because the ESP32 has many pins with specific functions, they may not be suitable for your projects. The following table shows which pins are safe to use and which pins require more attention before using them.
- – Your first priority pins. They are perfectly fine to use.
- – Pay attention as their behavior can be unpredictable, mainly during boot. Don’t use them unless you absolutely need to.
- – It is not recommended to use these pins. So avoid them.
Label | GPIO | Safe to use? | Reason |
D0 | 0 | must be HIGH during boot and LOW for programming | |
TX0 | 1 | Tx pin, used for flashing and debugging | |
D2 | 2 | must be LOW during boot and also connected to the on-board LED | |
RX0 | 3 | Rx pin, used for flashing and debugging | |
D4 | 4 | ||
D5 | 5 | must be HIGH during boot | |
D6 | 6 | Connected to Flash memory | |
D7 | 7 | Connected to Flash memory | |
D8 | 8 | Connected to Flash memory | |
D9 | 9 | Connected to Flash memory | |
D10 | 10 | Connected to Flash memory | |
D11 | 11 | Connected to Flash memory | |
D12 | 12 | must be LOW during boot | |
D13 | 13 | ||
D14 | 14 | ||
D15 | 15 | must be HIGH during boot, prevents startup log if pulled LOW | |
RX2 | 16 | ||
TX2 | 17 | ||
D18 | 18 | ||
D19 | 19 | ||
D21 | 21 | ||
D22 | 22 | ||
D23 | 23 | ||
D25 | 25 | ||
D26 | 26 | ||
D27 | 27 | ||
D32 | 32 | ||
D33 | 33 | ||
D34 | 34 | Input only GPIO, cannot be configured as output | |
D35 | 35 | Input only GPIO, cannot be configured as output | |
VP | 36 | Input only GPIO, cannot be configured as output | |
VN | 39 | Input only GPIO, cannot be configured as output |
For your convenience, here is an image showing which GPIO pins are safe to use.

Input Only GPIOs
Pins GPIO34, GPIO35, GPIO36(VP) and GPIO39(VN) cannot be configured as outputs, they can be used as either digital inputs, analog inputs, or for other unique purposes. Also note that they do not have internal pull-up or pull-down resistors, like the other GPIO pins.
Also pins GPIO36(VP) and GPIO39(VN) are an integral part of the ultra-low-noise pre-amplifier for the ADC, which help to configure the sampling time and noise of the pre-amp.
ESP32 Interrupt Pins
All GPIOs can be configured as interrupts.
ESP32 ADC Pins
The ESP32 has fifteen 12-bit ADC input channels. These are GPIOs that can be used to convert the analog voltage on the pin to a digital number.

The ADC on the ESP32 is a 12-bit ADC meaning it has the ability to detect 4096 (212) discrete analog levels. In other words, it will map input voltages between 0 and the operating voltage 3.3V into integer values between 0 and 4095. For example, this yields a resolution between readings of: 3.3 volts / 4096 units or, 0.0008 volts (0.8 mV) per unit.
You also have the ability to set the ADC resolution and ADC range of your channels in code.
Warning:
The ADC2 pins cannot be used when Wi-Fi is enabled. If your project requires Wi-Fi, consider using the ADC1 pins instead.
ESP32 DAC Pins
The ESP32 features two 8-bit DAC channels that can be used to convert digital signals into true analog voltages. It can be used as a “digital potentiometer” to control analog devices.

This dual-DAC on the ESP32 has 8-bit resolution, which means that values between 0 and 256 will produce an analog voltage somewhere between 0 and 3.3V.
ESP32 Touch Pins
ESP32 has 9 capacitive touch-sensing GPIOs. When a capacitive load (such as a human finger) is in close proximity to the GPIO, the ESP32 detects the change in capacitance.

These pins can be easily turned into a touchpad by connecting them to any conductive object such as wire, thread, foil, cloth, conductive paint, etc. The low-noise nature of the design and the high sensitivity of the circuit allow relatively small pads to be used.
These capacitive touch pins can also be used to wake the ESP32 from deep sleep.
ESP32 SPI Pins
SPI Pins ESP32 features three SPIs (SPI, HSPI and VSPI) in slave and master modes. These SPIs also support the following general-purpose SPI features:
- 4 timing modes of the SPI format transfer
- Up to 80 MHz and the divided clocks of 80 MHz
- Up to 64-Byte FIFO

Only VSPI and HSPI are usable SPI interfaces and the third SPI bus is used by the integrated flash memory chip. Standard libraries usually use VSPI pins between the two.
HSPI vs. VSPI
Sometimes HSPI is misinterpreted as “Hardware” SPI and VSPI as “Virtual” or “Software” SPI. Although in reality they all work the same way!
ESP32 I2C Pins
The ESP32 has a single I2C bus that allows you to connect up to 112 sensors and peripherals. The SDA and SCL pins are, by default, assigned to the following pins. However, you can bit-bang the I2C protocol on any GPIO pins with wire.begin(SDA, SCL)
command.

ESP32 UART Pins
ESP32 has 2 UART interfaces, i.e. UART0 and UART2, which provide asynchronous communication (RS232 and RS485) and IrDA support, and communicate at up to 5 Mbps.
- UART0 pins are connected to the USB-to-Serial converter and are used for flashing and debugging. Therefore it is not recommended to use the UART0 pins.
- UART2, on the other hand, are additional Serial1 pins, and are not connected to the USB-to-Serial converter. This means that you can use them to connect to UART-devices such as GPS, fingerprint sensor, etc.

ESP32 PWM Pins
The board has 25 channels (Nearly All GPIO pins) of PWM pins controlled by Pulse Width Modulation (PWM) controller. The PWM output can be used for driving digital motors and LEDs.

The controller consists of PWM timers and the PWM operator. Each timer provides timing in synchronous or independent form, and each PWM operator generates the waveform for one PWM channel.
ESP32 RTC GPIO Pins
Some GPIOs are routed to the RTC low-power subsystem, they are called RTC GPIOs. These are special pins that are used to wake the ESP32 from deep sleep when the Ultra Low Power (ULP) co-processor is running. The following GPIOs can be used as external wake up sources.

ESP32 Power Pins
There are two power pins viz. VIN pin & 3.3V pin. The VIN pin can be used to directly supply the ESP32 and its peripherals, if you have a regulated 5V voltage source. The 3.3V pin is the output of an on-board voltage regulator. This pin can be used to supply power to external components. GND is a ground pin of ESP32 development board.

ESP32 Enable Pin
EN Pin is used to enable ESP32. The chip is enabled when pulled HIGH. When pulled LOW the chip works at minimum power.
