ESP32 Safe GPIO Pins: Which Pins You Can (and Can't) Use
One of the most confusing aspects of the ESP32 for beginners is understanding which GPIO pins are safe to use. Unlike an Arduino Uno where nearly every pin works the same way, the ESP32 has strapping pins, input-only pins, flash-dedicated pins, and pins with Wi-Fi conflicts.
This guide categorizes every ESP32 GPIO pin by safety level so you can make the right choice for your project.
Pin Safety Categories
π’ GREEN: Safe to Use
These pins are safe for any digital I/O, PWM, or peripheral function. No boot issues, no conflicts:
| GPIO | Notes |
|---|---|
| GPIO13 | Also ADC2_CH4, TOUCH4, HSPI_MOSI |
| GPIO14 | Also ADC2_CH6, TOUCH6, HSPI_CLK |
| GPIO16 | UART2 RX β safe for general use when not used as UART |
| GPIO17 | UART2 TX β safe for general use when not used as UART |
| GPIO18 | VSPI_CLK β safe for general use when not used as SPI |
| GPIO19 | VSPI_MISO β safe for general use when not used as SPI |
| GPIO21 | I2C_SDA β safe for general use when not used as I2C |
| GPIO22 | I2C_SCL β safe for general use when not used as I2C |
| GPIO23 | VSPI_MOSI β safe for general use when not used as SPI |
| GPIO25 | Also DAC_1, ADC2_CH8 |
| GPIO26 | Also DAC_2, ADC2_CH9 |
| GPIO27 | Also ADC2_CH7, TOUCH7 |
| GPIO32 | ADC1_CH4, TOUCH9 β preferred for analog |
| GPIO33 | ADC1_CH5, TOUCH8 β preferred for analog |
π‘ YELLOW: Use with Caution
These pins work for general I/O but have restrictions you must be aware of:
| GPIO | Restriction |
|---|---|
| GPIO0 | Strapping pin. Must be HIGH for normal boot, LOW for flash mode. Use with external pull-up or avoid. |
| GPIO2 | Strapping pin. Must be LOW/floating during flashing. Onboard LED on some boards. |
| GPIO4 | ADC2_CH0 β unreliable when Wi-Fi is on. Strapping on some boards. |
| GPIO5 | Strapping pin. Briefly toggles during boot on some boards. |
| GPIO12 | Strapping pin (MTDI). If pulled HIGH, sets flash voltage to 1.8V β may prevent boot. |
| GPIO15 | Strapping pin (MTDO). If pulled LOW, disables ROM boot messages. |
| GPIO1 | UART0 TX β connected to USB-Serial. Avoid using for general I/O. |
| GPIO3 | UART0 RX β connected to USB-Serial. Avoid using for general I/O. |
| GPIO34 | Input-only. Cannot output digital HIGH/LOW. Great for ADC. |
| GPIO35 | Input-only. Cannot output digital HIGH/LOW. Great for ADC. |
| GPIO36 | Input-only (SENSOR_VP). ADC1_CH0. No output. |
| GPIO39 | Input-only (SENSOR_VN). ADC1_CH3. No output. |
π΄ RED: Do Not Use
These pins are connected to the internal SPI flash memory. Using them will crash your ESP32:
| GPIO | Function |
|---|---|
| GPIO6 | FLASH_CLK (SPI clock to flash memory) |
| GPIO7 | FLASH_D0 (Flash data line 0) |
| GPIO8 | FLASH_D1 (Flash data line 1) |
| GPIO9 | FLASH_D2 (Flash data line 2) |
| GPIO10 | FLASH_D3 (Flash data line 3) |
| GPIO11 | FLASH_CMD (Flash command line) |
Quick Decision Flowchart
Use this decision tree to pick the right pin for your project:
- Need analog input + Wi-Fi? β Use ADC1 pins (GPIO32βGPIO39)
- Need analog input + no Wi-Fi? β Any ADC pin works (ADC1 or ADC2)
- Need digital output (LED, relay)? β Use green GPIOs (13,14,16,17,18,19,21,22,23,25,26,27,32,33)
- Need I2C? β GPIO21 (SDA) and GPIO22 (SCL) β or remap to any green pin
- Need SPI? β VSPI: GPIO23 (MOSI), GPIO19 (MISO), GPIO18 (CLK), GPIO5 (CS)
- Need UART? β UART2: GPIO16 (RX), GPIO17 (TX)
- Need touch input? β GPIO0,2,4,12,13,14,15,27,32,33 (TOUCH0β9)
- Beginner, first project? β Start with GPIO16, GPIO17, GPIO18, GPIO19, GPIO21, GPIO22, GPIO23
Beginner's Cheat Sheet
If you're just starting with ESP32, memorize these simple rules:
- Avoid GPIO6βGPIO11 entirely (they connect to flash memory)
- Avoid GPIO1 and GPIO3 (they are used for USB-Serial communication)
- Use GPIO16, GPIO17, GPIO18, GPIO19, GPIO21, GPIO22, GPIO23 for your first projects
- Use GPIO32 or GPIO33 for analog sensors (ADC1 β works with Wi-Fi)
- If your project stops uploading: check if GPIO0, GPIO2, GPIO5, GPIO12, or GPIO15 is being pulled LOW or HIGH at boot
π§ Find Safe Pins Visually
Our interactive ESP32 pinout tool color-codes every pin by safety level. Hover to see full details.
Open Interactive PinoutFrequently Asked Questions
Which ESP32 pins are 5V tolerant?
None. ESP32 GPIO pins are 3.3V logic only. Applying 5V to any GPIO will damage the pin or the entire chip. Use a level shifter for 5V sensors and devices.
Can I use the flash pins if I have a custom board design?
GPIO6βGPIO11 are physically bonded to the flash memory on the ESP32-WROOM module. On a custom board using the bare ESP32 chip, these can be repurposed only if you use an external SPI flash on different pins β but this is extremely advanced and not recommended.
Why are some pins input-only?
GPIO34, GPIO35, GPIO36, and GPIO39 lack output drivers in the ESP32 silicon. They are designed as input-only pins primarily for ADC use. This is a hardware limitation, not a configuration setting.