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:
– generally usable in the indicated direction.
– check the board and its startup requirements.
– 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:
Output:![]()
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:
Output:![]()
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:
Output:![]()
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:
Output:![]()
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:
Output: ![]()
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:
Output: ![]()
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:
Output: ![]()
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:
Output: ![]()
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:
Output: ![]()
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:
Output: ![]()
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:
Output: ![]()
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:
Output: ![]()
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:
Output: ![]()
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:
Output: ![]()
JTAG MTCK pin.
GPIO 14
Input:
Output: ![]()
JTAG MTMS pin. If its startup level matters to your project, measure it on your own board.
GPIO 15
Input:
Output: ![]()
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:
Output: ![]()
One commonly used default pin for UART2 RX on ESP-WROOM-32 development boards.
GPIO 17
Input:
Output: ![]()
One commonly used default pin for UART2 TX on ESP-WROOM-32 development boards.
GPIO 18
Input:
Output: ![]()
GPIO 19
Input:
Output: ![]()
GPIO 21
Input:
Output: ![]()
A common default I²C SDA pin in the Arduino environment for the classic ESP32.
GPIO 22
Input:
Output: ![]()
A common default I²C SCL pin in the Arduino environment for the classic ESP32.
GPIO 23
Input:
Output: ![]()
GPIO 25
Input:
Output: ![]()
GPIO 26
Input:
Output: ![]()
GPIO 27
Input:
Output: ![]()
GPIO 32
Input:
Output: ![]()
GPIO 33
Input:
Output: ![]()
GPIO 34
Input:
Output: ![]()
Input only; it has no internal pull-up or pull-down resistor. Add an external resistor if your circuit needs one.
GPIO 35
Input:
Output: ![]()
Input only; it has no internal pull-up or pull-down resistor. Add an external resistor if your circuit needs one.
GPIO 36
Input:
Output: ![]()
Input only; it has no internal pull-up or pull-down resistor. Add an external resistor if your circuit needs one.
GPIO 39
Input:
Output: ![]()
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.
| UART | Common RX | Common TX | Note |
|---|---|---|---|
| UART0 | GPIO3 | GPIO1 | Usually used by the development board’s USB-to-serial converter. |
| UART1 | Route to another free GPIO | Route to another free GPIO | The default GPIO9/10 pins belong to the module’s flash memory. |
| UART2 | GPIO16 | GPIO17 | Check 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.
| GPIO21 | SDA |
| GPIO22 | SCL |

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:
| SPI | MOSI | MISO | CLK | CS |
|---|---|---|---|---|
| VSPI | GPIO23 | GPIO19 | GPIO18 | GPIO5 |
| HSPI | GPIO13 | GPIO12 | GPIO14 | GPIO15 |
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 |
| GPIO7 | SDO/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_0 | GPIO36 |
| ADC1_1 | GPIO37 |
| ADC1_2 | GPIO38 |
| ADC1_3 | GPIO39 |
| ADC1_4 | GPIO32 |
| ADC1_5 | GPIO33 |
| ADC1_6 | GPIO34 |
| ADC1_7 | GPIO35 |
| ADC2_0 | GPIO4 |
| ADC2_1 | GPIO0 |
| ADC2_2 | GPIO2 |
| ADC2_3 | GPIO15 |
| ADC2_4 | GPIO13 |
| ADC2_5 | GPIO12 |
| ADC2_6 | GPIO14 |
| ADC2_7 | GPIO27 |
| ADC2_8 | GPIO25 |
| ADC2_9 | GPIO26 |

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:
| DAC1 | GPIO25 |
| DAC2 | GPIO26 |
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_GPIO0 | GPIO36 |
| RTC_GPIO3 | GPIO39 |
| RTC_GPIO4 | GPIO34 |
| RTC_GPIO5 | GPIO35 |
| RTC_GPIO6 | GPIO25 |
| RTC_GPIO7 | GPIO26 |
| RTC_GPIO8 | GPIO33 |
| RTC_GPIO9 | GPIO32 |
| RTC_GPIO10 | GPIO4 |
| RTC_GPIO11 | GPIO0 |
| RTC_GPIO12 | GPIO2 |
| RTC_GPIO13 | GPIO15 |
| RTC_GPIO14 | GPIO13 |
| RTC_GPIO15 | GPIO12 |
| RTC_GPIO16 | GPIO14 |
| RTC_GPIO17 | GPIO27 |
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:
| Touch0 | GPIO4 |
| Touch1 | GPIO0 |
| Touch2 | GPIO2 |
| Touch3 | GPIO15 |
| Touch4 | GPIO13 |
| Touch5 | GPIO12 |
| Touch6 | GPIO14 |
| Touch7 | GPIO27 |
| Touch8 | GPIO33 |
| Touch9 | GPIO32 |

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:
| GPIO | What to check at startup |
|---|---|
| GPIO0 | High 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. |
| GPIO2 | Leave it floating or hold it low for serial download mode. With GPIO0 high for normal flash boot, GPIO2 does not select the boot mode. |
| GPIO5 | Strapping pin; make sure an external circuit does not unintentionally change its sampled startup level. |
| GPIO12 / MTDI | Do 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 / MTDO | Holding 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.
| GPIO12 | MTDI pin | |
| GPIO13 | MTCK pin | |
| GPIO14 | MTMS pin | |
| GPIO15 | MTDO 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.
