ESP32 PinOut – which pin is for what

Which ESP32 GPIO pins can we use in our projects, and which ones call for extra care? In this guide we look at the classic ESP32, especially development boards based on the ESP-WROOM-32 module.

Difficulty: Beginner

Technically reviewed: October 2026

Reference platform: ESP-WROOM-32 module

The ESP32 chip has 48 physical pins, but that does not mean it offers 48 freely usable GPIOs. Some pins are reserved for power, flash memory, or startup functions. Many others can serve more than one purpose, and we can select suitable functions in our program.

The ESP-WROOM-32 module

When designing a custom ESP32 circuit, we can use an ESP-WROOM-32 module. It contains the classic ESP32 chip, flash memory, and an antenna, but not the USB-to-serial converter, voltage regulator, and other convenience circuits found on development boards. In a custom design, we must provide the necessary support circuits and a suitable power supply ourselves.

Classic ESP32 development boards come in several versions, with different pinouts and onboard circuits. Not every GPIO is available on every board, some pins may already be connected to an onboard LED or another component. Always check the schematic of your particular board. Other members of the ESP32 family, such as the ESP32-S2, -S3, and -C3, can have different pinouts.

30-pin ESP32 development board

The image below shows the pinout of one 30-pin development board based on the ESP-WROOM-32. Compare its labels with those on your own board before connecting anything.

38-pin ESP32 development board

The next diagram shows the pinout of a 38-pin development board based on the ESP-WROOM-32.

ESP32 peripherals

We can use ESP32 pins as digital inputs or outputs, or with peripherals such as UART, I²C, SPI, ADC, DAC, and PWM. When choosing a pin, consider both its capabilities and its role during startup.

The IO MUX and GPIO matrix can route many digital peripheral signals to other suitable GPIOs. This does not mean that every function works on every pin: ADC, DAC, and capacitive touch functions use specific pins, while input-only GPIOs cannot generate output signals.

Some peripheral functions, including ADC, DAC, touch sensing, and JTAG, use specific GPIO pins.

On the ESP-WROOM-32 module, GPIO6–GPIO11 are connected to flash memory. Do not use them for general-purpose wiring: interfering with the flash connection can cause startup or runtime failures.

Using a peripheral’s common default pins can make libraries and example sketches easier to follow.

The classic ESP32 provides the following peripherals:

2 ADC controllers with 18 analog input channels in total
2 DAC channels
16 LEDC PWM channels
3 UART controllers
2 I²C controllers
4 SPI controllers; SPI2/HSPI and SPI3/VSPI can be used for general-purpose peripherals
2 I²S controllers
10 capacitive touch channels
A built-in Hall sensor on the classic ESP32 chip; Arduino-ESP32 3.x no longer supports the old hallRead() call

Using ESP32 GPIO pins as inputs or outputs

Some pins have special roles while the ESP32 starts up. The list below shows which pins are suitable as inputs or outputs, which need extra care, and which should be left alone.

What the icons mean:
green indicator – generally usable in the indicated direction.
yellow indicator – check the board and its startup requirements.
red indicator – do not use it for this purpose.

These icons are guidance for classic ESP-WROOM-32-based boards. Other ESP32 development boards may differ.

GPIO 0
Input:check before use Output:check before use

The level of GPIO0 at startup determines whether the program runs from flash or the serial download mode starts. Its internal pull-up normally keeps it high; it is pulled low for uploading. Because it is a strapping pin, any circuit connected to it must not force the wrong level during a reset.


GPIO 1
Input:do not use Output:check before use

UART0 TX pin: startup messages may appear here, and it may also be connected to the board’s USB-to-serial converter. Choose it for another purpose only if that will not interfere with serial communication.


GPIO 2
Input:check before use Output:check before use

Strapping pin: to enter serial download mode, it must be left floating or held low. Some development boards connect their onboard LED to GPIO2, but this is not universal.


GPIO 3
Input:check before use Output:do not use

UART0 RX pin: used for uploading programs and serial communication. Connecting another circuit here can interfere with uploads or the serial connection.


GPIO 4
Input: usable Output: usable

Can be used as a general digital input or output. Check whether your particular board connects it to another peripheral or onboard circuit.


GPIO 5
Input: check before use Output: check before use

Strapping pin. It can be used as a general GPIO, but an external circuit must not change the level sampled at startup.


GPIO 6
Input: do not use Output: do not use

GPIO6 (SCK/CLK) may be exposed on some development boards, but it is connected to the ESP-WROOM-32 module’s flash memory. Do not use it for your own circuit.


GPIO 7
Input: do not use Output: do not use

GPIO7 (SDO/SD0) may be exposed on some development boards, but it is connected to the ESP-WROOM-32 module’s flash memory. Do not use it for your own circuit.


GPIO 8
Input: do not use Output: do not use

GPIO8 (SDI/SD1) may be exposed on some development boards, but it is connected to the ESP-WROOM-32 module’s flash memory. Do not use it for your own circuit.


GPIO 9
Input: do not use Output: do not use

GPIO9 (SHD/SD2) may be exposed on some development boards, but it is connected to the ESP-WROOM-32 module’s flash memory. Do not use it for your own circuit.


GPIO 10
Input: do not use Output: do not use

GPIO10 (SWP/SD3) may be exposed on some development boards, but it is connected to the ESP-WROOM-32 module’s flash memory. Do not use it for your own circuit.


GPIO 11
Input: do not use Output: do not use

GPIO11 (CSC/CMD) may be exposed on some development boards, but it is connected to the ESP-WROOM-32 module’s flash memory. Do not use it for your own circuit.


GPIO 12
Input: check before use Output: check before use

GPIO12/MTDI is a strapping and JTAG pin. On a typical ESP-WROOM-32 module with 3.3 V flash, do not force it high at startup: this can select a 1.8 V flash supply and prevent the board from booting. Other ESP32 modules may use different flash supplies, so check the module’s own datasheet.


GPIO 13
Input: usable Output: usable

JTAG MTCK pin.


GPIO 14
Input: usable Output: usable

JTAG MTMS pin. If its startup level matters to your project, measure it on your own board.


GPIO 15
Input: check before use Output: check before use

Strapping and JTAG MTDO pin. Its internal pull-up normally keeps it high. Holding it low at startup suppresses the ROM boot messages, but does not by itself prevent the ESP32 from booting.


GPIO 16
Input: usable Output: usable

One commonly used default pin for UART2 RX on ESP-WROOM-32 development boards.


GPIO 17
Input: usable Output: usable

One commonly used default pin for UART2 TX on ESP-WROOM-32 development boards.


GPIO 18
Input: usable Output: usable


GPIO 19
Input: usable Output: usable


GPIO 21
Input: usable Output: usable

A common default I²C SDA pin in the Arduino environment for the classic ESP32.


GPIO 22
Input: usable Output: usable

A common default I²C SCL pin in the Arduino environment for the classic ESP32.


GPIO 23
Input: usable Output: usable


GPIO 25
Input: usable Output: usable


GPIO 26
Input: usable Output: usable


GPIO 27
Input: usable Output: usable


GPIO 32
Input: usable Output: usable


GPIO 33
Input: usable Output: usable


GPIO 34
Input: usable Output: do not use

Input only; it has no internal pull-up or pull-down resistor. Add an external resistor if your circuit needs one.


GPIO 35
Input: usable Output: do not use

Input only; it has no internal pull-up or pull-down resistor. Add an external resistor if your circuit needs one.


GPIO 36
Input: usable Output: do not use

Input only; it has no internal pull-up or pull-down resistor. Add an external resistor if your circuit needs one.


GPIO 39
Input: usable Output: do not use

Input only; it has no internal pull-up or pull-down resistor. Add an external resistor if your circuit needs one.


UART

UART (Universal Asynchronous Receiver/Transmitter) provides asynchronous serial communication. The UART signals on the ESP32 GPIO pins cannot be connected directly to RS-232, RS-422, or RS-485 wiring; those interfaces require a suitable level converter or transceiver.

The classic ESP32 has three UART controllers. We can configure the baud rate, number of data and stop bits, parity, and other settings. Its GPIO pins use 3.3 V logic; do not drive an ESP32 input directly with a 5 V signal.

In the Arduino environment, the additional UART controllers can be used through the HardwareSerial class.

The GPIO matrix lets us route UART signals to other suitable pins. GPIO34–GPIO39 are input only, so they cannot serve as TX pins.

On the development boards shown here, UART0 is usually connected to the USB-to-serial converter for uploading programs and viewing serial logs.

One default pin pair for UART1 is GPIO9/GPIO10, but those pins belong to the flash memory on an ESP-WROOM-32 module. Route UART1 to other free pins instead.

GPIO16/GPIO17 are a common pin pair for UART2. Check the schematic of your module and board before using them: on other ESP32 modules, PSRAM may reserve those pins.

UARTCommon RXCommon TXNote
UART0GPIO3GPIO1Usually used by the development board’s USB-to-serial converter.
UART1Route to another free GPIORoute to another free GPIOThe default GPIO9/10 pins belong to the module’s flash memory.
UART2GPIO16GPIO17Check your particular module and board.

I2C

The classic ESP32 has two I²C controllers. SDA and SCL can be assigned to many suitable GPIOs, but not to the input-only GPIO34–GPIO39: devices must be able to pull the I²C lines low. Both lines need pull-up resistors. Many breakout boards already have them, but check before wiring your circuit.

GPIO21 (SDA) and GPIO22 (SCL) are a common default pair in the Arduino environment for the classic ESP32 boards shown here. Other ESP32 family members and boards may differ.

GPIO21SDA
GPIO22SCL

The following example starts two I²C controllers on separate pin pairs. The addresses 0x10 and 0x12 are placeholders: replace them with your devices’ actual addresses. The meaning of the data byte depends on each device’s documentation.

#include <Wire.h>

const int sdaPin1 = 26;
const int sclPin1 = 25;
const int sdaPin2 = 33;
const int sclPin2 = 32;

TwoWire mywire1 = TwoWire(0);
TwoWire mywire2 = TwoWire(1);

void setup()
{
  mywire1.begin(sdaPin1, sclPin1, 100000);
  mywire2.begin(sdaPin2, sclPin2, 100000);
}

void loop()
{
  mywire1.beginTransmission(0x10);
  mywire1.write(0x20);
  byte result1 = mywire1.endTransmission();

  mywire2.beginTransmission(0x12);
  mywire2.write(0x20);
  byte result2 = mywire2.endTransmission();

  // 0 = success; otherwise check the address, wiring, and pull-ups.
  if (result1 != 0 || result2 != 0)
  {
    // Add error handling suitable for your project here.
  }
  delay(1000);
}

SPI

The classic ESP32 has four SPI controllers. SPI2/HSPI and SPI3/VSPI are normally used for external SPI peripherals.

SPI0 and SPI1 are associated with flash memory. Even if some of their pins are exposed on a development board, do not use them for your own SPI devices. In particular, leave the module’s flash pins GPIO6–GPIO11 alone.

That leaves two general-purpose SPI controllers: HSPI and VSPI. Their signals can be routed to other suitable free GPIOs. These are commonly used default pins on the classic ESP32:

SPIMOSIMISOCLKCS
VSPIGPIO23GPIO19GPIO18GPIO5
HSPIGPIO13GPIO12GPIO14GPIO15

Pay particular attention to the startup requirements of GPIO12, the default HSPI MISO pin. On a typical ESP-WROOM-32 module with 3.3 V flash, it must not be forced high at startup: doing so may select a 1.8 V flash supply and prevent booting.

The diagram below also marks GPIO6–GPIO11, which are connected to the flash memory used by SPI0/SPI1. Do not connect your own SPI devices to those pins.

SPI flash memory in the module

The ESP-WROOM-32 module uses GPIO6–GPIO11 for its flash memory. Even if they appear on a development board, do not use them as general-purpose inputs or outputs.

GPIO6 SCK/CLK
GPIO7SDO/SD0
GPIO8 SDI/SD1
GPIO9 SHD/SD2
GPIO10 SWP/SD3
GPIO11 CSC/CMD

Analog-to-digital converter (ADC)

The ESP32 has two 12-bit SAR analog-to-digital converters. ADC1 has eight channels, while ADC2 has ten.

At 12-bit resolution, the raw ADC reading is a number from 0 to 4095. That does not make it a direct 0–3.3 V voltmeter: the measurable voltage range depends on the attenuation setting, while chip-to-chip variation and calibration affect accuracy.

We can configure the ADC resolution and input range in our code.

Using ADC2 can conflict with Wi-Fi operation. For analog measurements in a Wi-Fi project, choose ADC1 pins.

The table below lists the chip’s ADC channels. GPIO37 and GPIO38 are generally not accessible on ESP-WROOM-32 development boards. Check the documentation for your own module and board to see which pins are actually brought out.

ADC1_0GPIO36
ADC1_1GPIO37
ADC1_2GPIO38
ADC1_3GPIO39
ADC1_4GPIO32
ADC1_5GPIO33
ADC1_6GPIO34
ADC1_7GPIO35
ADC2_0GPIO4
ADC2_1GPIO0
ADC2_2GPIO2
ADC2_3GPIO15
ADC2_4GPIO13
ADC2_5GPIO12
ADC2_6GPIO14
ADC2_7GPIO27
ADC2_8GPIO25
ADC2_9GPIO26

ESP32 ADC readings can be noisy and may not be linear across the full range. For more accurate voltage measurements, select the right attenuation, calibrate the readings, and consider an external ADC if necessary.

Digital-to-analog converter (DAC)

The classic ESP32 has two independent 8-bit digital-to-analog converter (DAC) channels. They convert a digital value into an analog voltage at the corresponding GPIO output.

An 8-bit DAC maps a digital value from 0 to 255 to an output voltage roughly between zero and its reference voltage. The following equation is an ideal approximation: the actual voltage also depends on the supply, the connected load, and DAC accuracy.

DAC output voltage ≈ digital value × (Vref / 255)

The DAC reference is tied to the VDD3P3_RTC supply rail, which ideally is close to the supply voltage.

The image shows the VDD3P3_RTC supply pin on the chip.

This is not a separate precision reference that can be adjusted on the development board.

The dedicated DAC pins are:

DAC1GPIO25
DAC2GPIO26

The following diagram shows where those two pins are located.

RTC GPIO pins

The classic ESP32 has RTC GPIO pins that belong to its low-power RTC subsystem. A suitably configured RTC pin can wake the chip from deep sleep in response to an external event, such as a button press; the ULP coprocessor does not necessarily need to be running.

For example, we can connect a button to an RTC GPIO and use it to wake the ESP32.

The RTC GPIO pin mapping is listed below:

RTC_GPIO0GPIO36
RTC_GPIO3GPIO39
RTC_GPIO4GPIO34
RTC_GPIO5GPIO35
RTC_GPIO6GPIO25
RTC_GPIO7GPIO26
RTC_GPIO8GPIO33
RTC_GPIO9GPIO32
RTC_GPIO10GPIO4
RTC_GPIO11GPIO0
RTC_GPIO12GPIO2
RTC_GPIO13GPIO15
RTC_GPIO14GPIO13
RTC_GPIO15GPIO12
RTC_GPIO16GPIO14
RTC_GPIO17GPIO27

The following image highlights the RTC GPIO pins on a 38-pin ESP32 development board:

PWM

PWM (pulse-width modulation) produces a rapidly switching digital output. By changing its duty cycle, we can adjust an LED’s brightness or control a motor driver’s input, for example. The GPIO does not output a true, steady analog voltage; use a DAC or a suitable filter if your project needs one.

The classic ESP32’s LEDC peripheral provides 16 PWM channels. PWM can be generated on suitable output GPIOs; the input-only GPIO34–GPIO39 cannot be used for this purpose. Avoid pins reserved for flash, and check startup-related pins carefully.

When configuring PWM, we choose a frequency, a resolution, and an output GPIO. Channel handling depends on the Arduino-ESP32 version; the LEDC API in version 3.x can assign a channel to the selected pin automatically.

Frequency and a compatible resolution
Duty cycle
Suitable output GPIO
Channel, if the selected API requires it explicitly

Interrupt

We can configure a GPIO interrupt on many free input pins, for example to detect a button changing state. Startup, flash, and input-only pins still have their own restrictions. On some ESP32 variants, interrupts on GPIO36 and GPIO39 require extra care when combined with ADC use or radio operation in sleep modes.

Capacitive touch GPIO pins

The classic ESP32 has ten capacitive touch channels. They monitor changes in capacitance at a connected electrode and can detect, for example, a finger approaching or touching it. We must choose one of the GPIO pins that supports touch sensing.

A touch sensor can also be configured to wake the ESP32 from deep sleep.

The touch channels are connected to these specific GPIO pins:

Touch0GPIO4
Touch1GPIO0
Touch2GPIO2
Touch3GPIO15
Touch4GPIO13
Touch5GPIO12
Touch6GPIO14
Touch7GPIO27
Touch8GPIO33
Touch9GPIO32

GPIO current limits

Do not treat the 40 mA source-current and 28 mA sink-current figures as generally recommended continuous loads for every GPIO: those figures are tied to specific datasheet test conditions. Use a suitable series resistor for an LED, and a transistor or another driver circuit for a larger load. Consider the limits of the whole board and its power supply as well.

ESP32 startup and strapping pins

At startup, the ESP32 samples the logic levels of certain pins. These levels can affect the boot mode, flash supply voltage, and ROM startup messages.

These are called strapping pins. When designing an external circuit, make sure it cannot force them to levels that select the wrong mode during a reset.

After startup, most of these pins can be used as ordinary GPIOs. The connected circuit must still remain safe for the next reset.

For a beginner project, choosing another pin is often easiest. If you do need a strapping pin, first check the schematic and startup levels of your particular development board.

These classic ESP32 pins have strapping functions:

GPIOWhat to check at startup
GPIO0High selects normal boot; low selects serial download mode. The automatic programming circuit on many development boards controls this, but the bare ESP-WROOM-32 module does not do it by itself.
GPIO2Leave it floating or hold it low for serial download mode. With GPIO0 high for normal flash boot, GPIO2 does not select the boot mode.
GPIO5Strapping pin; make sure an external circuit does not unintentionally change its sampled startup level.
GPIO12 / MTDIDo not force it high at startup on an ESP-WROOM-32 with 3.3 V flash: high may select a 1.8 V flash supply.
GPIO15 / MTDOHolding it low suppresses ROM boot messages. It does not need to be held high merely for the program to start.

JTAG

JTAG pins are used for hardware debugging. If we do not use JTAG, they can generally serve as GPIOs, but we must still account for the startup roles of GPIO12 and GPIO15.

GPIO12MTDI pin
GPIO13MTCK pin
GPIO14 MTMS pin
GPIO15MTDO pin

Enable (EN) pin

Pulling the EN (CHIP_PU) pin low disables the chip. On many development boards it has a pull-up resistor and an EN/RESET button; pressing the button restarts the microcontroller. The exact circuit depends on the board.

Built-in Hall effect sensor

Check the library version: the classic ESP32 chip has a Hall sensor, but the old hallRead() function was removed from Arduino-ESP32 3.x. Do not expect an older example sketch to work unchanged with the current Arduino core.

The ESP32’s built-in Hall effect sensor detects changes in the surrounding magnetic field.

I2S

I²S (Inter-IC Sound) is a digital audio interface. The classic ESP32 has two I²S peripherals, I²S0 and I²S1. Each can be configured as a controller or target and can transmit or receive audio data.

I²S signals can be routed to several suitable GPIOs. Check the input/output capability of each selected pin and the wiring of your particular board.


← Further Arduino Tutorials