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.

⚠️ Disclaimer Pin behavior can vary slightly between ESP32 board models (DevKit V1 vs NodeMCU-32S vs custom boards). Always verify with your board's schematic. This guide covers the standard ESP32-WROOM-32 module found on most development boards.

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:

GPIONotes
GPIO13Also ADC2_CH4, TOUCH4, HSPI_MOSI
GPIO14Also ADC2_CH6, TOUCH6, HSPI_CLK
GPIO16UART2 RX β€” safe for general use when not used as UART
GPIO17UART2 TX β€” safe for general use when not used as UART
GPIO18VSPI_CLK β€” safe for general use when not used as SPI
GPIO19VSPI_MISO β€” safe for general use when not used as SPI
GPIO21I2C_SDA β€” safe for general use when not used as I2C
GPIO22I2C_SCL β€” safe for general use when not used as I2C
GPIO23VSPI_MOSI β€” safe for general use when not used as SPI
GPIO25Also DAC_1, ADC2_CH8
GPIO26Also DAC_2, ADC2_CH9
GPIO27Also ADC2_CH7, TOUCH7
GPIO32ADC1_CH4, TOUCH9 β€” preferred for analog
GPIO33ADC1_CH5, TOUCH8 β€” preferred for analog

🟑 YELLOW: Use with Caution

These pins work for general I/O but have restrictions you must be aware of:

GPIORestriction
GPIO0Strapping pin. Must be HIGH for normal boot, LOW for flash mode. Use with external pull-up or avoid.
GPIO2Strapping pin. Must be LOW/floating during flashing. Onboard LED on some boards.
GPIO4ADC2_CH0 β€” unreliable when Wi-Fi is on. Strapping on some boards.
GPIO5Strapping pin. Briefly toggles during boot on some boards.
GPIO12Strapping pin (MTDI). If pulled HIGH, sets flash voltage to 1.8V β€” may prevent boot.
GPIO15Strapping pin (MTDO). If pulled LOW, disables ROM boot messages.
GPIO1UART0 TX β€” connected to USB-Serial. Avoid using for general I/O.
GPIO3UART0 RX β€” connected to USB-Serial. Avoid using for general I/O.
GPIO34Input-only. Cannot output digital HIGH/LOW. Great for ADC.
GPIO35Input-only. Cannot output digital HIGH/LOW. Great for ADC.
GPIO36Input-only (SENSOR_VP). ADC1_CH0. No output.
GPIO39Input-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:

GPIOFunction
GPIO6FLASH_CLK (SPI clock to flash memory)
GPIO7FLASH_D0 (Flash data line 0)
GPIO8FLASH_D1 (Flash data line 1)
GPIO9FLASH_D2 (Flash data line 2)
GPIO10FLASH_D3 (Flash data line 3)
GPIO11FLASH_CMD (Flash command line)
🚫 GPIO6–GPIO11 are DEADLY These pins are physically connected to the ESP32's SPI flash memory on the module. Any digital I/O operation on these pins will cause a system crash or exception. Do not connect anything to them.

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:

  1. Avoid GPIO6–GPIO11 entirely (they connect to flash memory)
  2. Avoid GPIO1 and GPIO3 (they are used for USB-Serial communication)
  3. Use GPIO16, GPIO17, GPIO18, GPIO19, GPIO21, GPIO22, GPIO23 for your first projects
  4. Use GPIO32 or GPIO33 for analog sensors (ADC1 β€” works with Wi-Fi)
  5. 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 Pinout

Frequently 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.

Related Guides